Repository navigation
Allow GCSToSambaOperator to write to the share root - #73863
MohammadHijjawi97 wants to merge 1 commit into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
|
The failing The samba hook, hive and common.compat failures are the follow-on "One or more mappers failed to initialize" error in the same pytest session (a samba change pulls in the google tests, so they share it). None of the failures are in This is the collection issue fixed on main by #74066, which was merged on Oct 2, after this run. I can rebase onto main so the job runs with that fix. |
The destination containment check added in apache#67857 compares the resolved path against destination_path + os.sep. For destination_path="/" that prefix becomes "//", and for "" or "." the resolved path is relative without a "./" prefix, so every object copied to the root of the share was rejected as being outside destination_path. Handle both forms the same way GCSToSFTPOperator and the S3-to-SFTP/FTP transfers already do, while still refusing ".." and absolute object names.
2ff6175 to
96e8b03
Compare
|
Rebased onto main to pick up #74066; no change to the PR's own code. |
GCSToSambaOperatorrejects every object copied to the root of the SMB share. The destination containment check added in #67857 compares the resolved path withdestination_path + os.sep, so:destination_path="/"builds the prefix"//", and"/dir/file.txt"does not start with it;destination_path=""or"."normalises to".", and the resolved relative path ("dir/file.txt") has no"./"prefix.In both cases the task fails with
ValueError: Resolved destination path ... is outside the configured destination_path, although the file would land inside the share. This has affected the operator since samba provider 4.12.6.This PR handles the share root the same way
GCSToSFTPOperator._resolve_destination_pathand the Amazonvalidate_destination_pathhelper already do:..or that are absolute;Object names containing
..are still refused.Tests: added parametrized cases for
/,""and.as the destination, plus traversal cases from a relative share root.pytest providers/samba/tests/unit/samba/transfers/test_gcs_to_samba.py: 32 passed; the 3 share-root cases fail without the change.ruff format/ruff checkare clean.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines
I used an AI coding assistant (Claude Code) while writing the fix and tests; I reviewed the changes and ran the checks listed above.