Skip to content

Fix XCom object storage backend path validation#56244

Merged
amoghrajesh merged 1 commit intoapache:mainfrom
amoghrajesh:fix-universal-pathlib0
Sep 30, 2025
Merged

Fix XCom object storage backend path validation#56244
amoghrajesh merged 1 commit intoapache:mainfrom
amoghrajesh:fix-universal-pathlib0

Conversation

@amoghrajesh
Copy link
Copy Markdown
Contributor

universal_pathlib releases a 0.3.0 version and that added pathlib_abc==0.5.1 in it, which introduced stricter type checking on Path objects.

The original code was calling is_relative_to() incorrectly on Path objects leading to error:

  Using airflow version from current sources

  providers/common/io/src/airflow/providers/common/io/xcom/backend.py:105: error: Argument 1 to "is_relative_to" of "PurePath" has incompatible type "ObjectStoragePath"; expected "PurePath"  [arg-type]
                  if not Path.is_relative_to(ObjectStoragePath(data), p):
                                             ^~~~~~~~~~~~~~~~~~~~~~~
  providers/common/io/src/airflow/providers/common/io/xcom/backend.py:105: error: Argument 2 to "is_relative_to" of "PurePath" has incompatible type "ObjectStoragePath"; expected "str | PathLike[str]" 
  [arg-type]
                  if not Path.is_relative_to(ObjectStoragePath(data), p):
                                                                      ^
  Found 2 errors in 1 file (checked 3984 source files)

I have changed to call it as an instance method on the ObjectStoragePath object itself.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@amoghrajesh amoghrajesh merged commit 180ec47 into apache:main Sep 30, 2025
78 checks passed
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants