Skip to content

Commit 7a75f0a

Browse files
authored
Protect against None components of universal pathlib xcom backend (#41921)
fixes: #41723
1 parent 7cf54a7 commit 7a75f0a

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

airflow/io/path.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def replace(self, target) -> ObjectStoragePath:
198198
199199
Returns the new Path instance pointing to the target path.
200200
"""
201-
return self.rename(target, overwrite=True)
201+
return self.rename(target)
202202

203203
@classmethod
204204
def cwd(cls):

airflow/providers/common/io/xcom/backend.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ def serialize_value(
142142

143143
base_path = _get_base_path()
144144
while True: # Safeguard against collisions.
145-
p = base_path.joinpath(dag_id, run_id, task_id, f"{uuid.uuid4()}{suffix}")
145+
p = base_path.joinpath(
146+
dag_id or "NO_DAG_ID",
147+
run_id or "NO_RUN_ID",
148+
task_id or "NO_TASK_ID",
149+
f"{uuid.uuid4()}{suffix}",
150+
)
146151
if not p.exists():
147152
break
148153
p.parent.mkdir(parents=True, exist_ok=True)

hatch_build.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -494,9 +494,7 @@
494494
# See https://github.com/apache/airflow/pull/31693
495495
# We should also remove "3rd-party-licenses/LICENSE-unicodecsv.txt" file when we remove this dependency
496496
"unicodecsv>=0.14.1",
497-
# The Universal Pathlib provides Pathlib-like interface for FSSPEC
498-
# https://github.com/apache/airflow/issues/41723 describes the issue
499-
"universal-pathlib==0.2.2", # Temporarily pin to 0.2.2 as 0.2.3 generates mypy errors
497+
"universal-pathlib>=0.2.3",
500498
# Werkzug 3 breaks Flask-Login 0.6.2, also connexion needs to be updated to >= 3.0
501499
# we should remove this limitation when FAB supports Flask 2.3 and we migrate connexion to 3+
502500
"werkzeug>=2.0,<3",

0 commit comments

Comments
 (0)