Dev-iL commented on code in PR #59785:
URL: https://github.com/apache/airflow/pull/59785#discussion_r2647689328
##########
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:
Thank you for the suggestion - fixed. Followup question: the existing code
produces paths starting with `/`, whereas `relative_to` doesn't have that. This
could be a breaking change for some users. Should I create a newsfragment in
this case?
--
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]