potiuk commented on code in PR #59785:
URL: https://github.com/apache/airflow/pull/59785#discussion_r2648703288
##########
airflow-core/src/airflow/dag_processing/dagbag.py:
##########
@@ -647,9 +647,16 @@ def collect_dags(
found_dags = self.process_file(filepath,
only_if_updated=only_if_updated, safe_mode=safe_mode)
file_parse_end_dttm = timezone.utcnow()
+ # Normalize paths to use forward slashes for consistent
cross-platform behavior.
+ # On Windows, settings.DAGS_FOLDER and filepath may have mixed
separators
+ # (e.g., DAGS_FOLDER='C:/foo/dags' vs
filepath='C:\foo\dags\my_dag.py'),
+ # causing the replace to fail.
+ normalized_filepath = Path(filepath).as_posix()
+ normalized_dags_folder = Path(settings.DAGS_FOLDER).as_posix()
Review Comment:
Technically speaking, starting with "/" idepends on whether your DAGS_FOLDER
was defined with "/" or not at the end.
I think this was ambiguous and **wrong** - precisely because it was not
defined precisely, and because "/" at the beginning of a path universally means
"start with root" - not "relative to DAGS FOLDER" which I guess was the
original intention.
So yes, I think both clarifying what FileStat produces and adding
newsfragment about it makes sense.
--
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]