MohammadHijjawi97 opened a new pull request, #73863:
URL: https://github.com/apache/airflow/pull/73863

   `GCSToSambaOperator` rejects every object copied to the root of the SMB 
share. The destination containment check added in #67857 compares the resolved 
path with `destination_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_path` and the Amazon 
`validate_destination_path` helper already do:
   - for a relative root, it rejects only paths that climb out with `..` or 
that are absolute;
   - for any other base, it strips a trailing separator before building the 
prefix.
   
   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 check` 
are clean.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   I used an AI coding assistant (Claude Code) while writing the fix and tests; 
I reviewed the changes and ran the checks listed above.
   


-- 
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]

Reply via email to