ashb commented on code in PR #48803:
URL: https://github.com/apache/airflow/pull/48803#discussion_r2029245226


##########
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:
   This feels slightly wierd to not be served as a 404 error, but I get why we 
are doing it this way.
   
   I still don't like it.



-- 
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