Skip to content

Commit

Permalink
Normalize input path
Browse files Browse the repository at this point in the history
  • Loading branch information
jason810496 committed Jan 20, 2025
1 parent 47df83c commit 983c75a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion airflow/api_fastapi/core_api/routes/public/dag_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from __future__ import annotations

import os
from typing import cast

from fastapi import HTTPException, status
Expand Down Expand Up @@ -45,7 +46,8 @@ def get_dag_report(
subdir: str,
):
"""Get DAG report."""
if not subdir.startswith(settings.DAGS_FOLDER):
fullpath = os.path.normpath(subdir)
if not fullpath.startswith(settings.DAGS_FOLDER):
raise HTTPException(status.HTTP_400_BAD_REQUEST, "subdir should be subpath of DAGS_FOLDER settings")
dagbag = DagBag(subdir)
return DagReportCollectionResponse(
Expand Down

0 comments on commit 983c75a

Please sign in to comment.