BasPH opened a new issue, #41598:
URL: https://github.com/apache/airflow/issues/41598

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.9.1 and 2.10.0
   
   ### What happened?
   
   XComs with a forward slash (/) in the key are not escaped when requesting 
the value from the API. Example on Airflow 2.10.0, in the XCom tab of a task 
pushing an XCom:
   
   <img width="883" alt="image" 
src="https://github.com/user-attachments/assets/e5c9d308-68f7-4af3-8e1e-dd31d63ebffe";>
   
   The / is not escaped in the call to 
https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html#operation/get_xcom_entry
 and therefore the API thinks it's a request with 2 parts, which then returns a 
404 because it's an unknown request structure.
   
   Note: the Admin -> XCom view does display the correct value, and tasks 
pulling the XCom are also able to function correctly, the issue in only in the 
UI.
   
   ### What you think should happen instead?
   
   XCom keys should be escaped for API requests.
   
   ### How to reproduce
   
   DAG to reproduce:
   ```python
   import datetime
   
   from airflow import DAG
   from airflow.models import TaskInstance
   from airflow.operators.python import PythonOperator
   
   with DAG(dag_id="xcom_example", schedule=None, 
start_date=datetime.datetime(2024, 1, 1)):
   
       def _push_xcom(ti: TaskInstance):
           ti.xcom_push(key="foo/bar", value="test")
   
       push_xcom = PythonOperator(task_id="push_xcom", 
python_callable=_push_xcom)
   
       def _pull_xcom(ti: TaskInstance):
           print(ti.xcom_pull(task_ids="push_xcom", key="foo/bar"))
   
       pull_xcom = PythonOperator(task_id="pull_xcom", 
python_callable=_pull_xcom)
   
       push_xcom >> pull_xcom
   ```
   
   Trigger the DAG and browse to the XCom tab of the `push_xcom` task to see 
the error. Tested on Airflow 2.9.1 and 2.10.0.
   
   ### Operating System
   
   N/A
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to