Skip to content

Commit 3304c2a

Browse files
potiukutkarsharma2
authored andcommitted
Protect against None components of universal pathlib xcom backend (#41921) (#41938)
fixes: #41723 (cherry picked from commit 7a75f0a)
1 parent 3273171 commit 3304c2a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
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-2
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,7 @@
497497
# See https://github.com/apache/airflow/pull/31693
498498
# We should also remove "3rd-party-licenses/LICENSE-unicodecsv.txt" file when we remove this dependency
499499
"unicodecsv>=0.14.1",
500-
# The Universal Pathlib provides Pathlib-like interface for FSSPEC
501-
"universal-pathlib==0.2.2", # Temporarily pin to 0.2.2 as 0.2.3 generates mypy errors
500+
"universal-pathlib>=0.2.3",
502501
# Werkzug 3 breaks Flask-Login 0.6.2, also connexion needs to be updated to >= 3.0
503502
# we should remove this limitation when FAB supports Flask 2.3 and we migrate connexion to 3+
504503
"werkzeug>=2.0,<3",

0 commit comments

Comments
 (0)