ashb commented on code in PR #48803:
URL: https://github.com/apache/airflow/pull/48803#discussion_r2029246357
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_sources.py:
##########
@@ -64,10 +64,15 @@ def get_dag_source(
status.HTTP_404_NOT_FOUND,
f"The source code of the DAG {dag_id}, version_number
{version_number} was not found",
)
-
- dag_source = dag_version.dag_code.source_code
+ if dag_code := dag_version.dag_code:
+ content = dag_code.source_code
+ else:
+ content = f"# Code not found for dag '{dag_id}'"
+ if version_number:
+ content += f" and version '{version_number}'"
Review Comment:
If this was in the UI only route, this would be fine, but I'm really not
convinced it should be a 200 in the public REST api.
--
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]