Skip to content

Preserve local objects when downloading onto the source - #2201

Open
zhechen-cs wants to merge 1 commit into
apache:trunkfrom
zhechen-cs:codex/local-download-same-file
Open

zhechen-cs wants to merge 1 commit into
apache:trunkfrom
zhechen-cs:codex/local-download-same-file

Conversation

@zhechen-cs

Copy link
Copy Markdown

Description

Handle shutil.SameFileError before ordinary copy failures in the local storage driver. Downloading an object onto itself still returns False, but no longer deletes the source object during failure cleanup.

The regression checks both an explicit source filename and its containing directory with a trailing separator, then verifies the stored contents and object metadata remain available.

Fixes #2200

Status

Ready for review.

Validation

  • Local storage and base storage tests: 33 passed, 2 subtests passed (Python 3.12).
  • Both regression cases fail against unmodified trunk with FileNotFoundError after the source is deleted.
  • Black, isort, flake8, pylint and git diff --check pass for the changed files.
  • Live cloud integration tests were not run; this fix only affects the local storage driver.

Checklist

  • Code linting
  • Documentation (no public API change)
  • Tests
  • ICLA (small bug fix)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local storage downloads onto the source delete the stored object

1 participant