Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): avoid crash when using copyFrom together with symlinks #6485

Merged
merged 5 commits into from
Sep 26, 2024

Conversation

stefreak
Copy link
Member

@stefreak stefreak commented Sep 25, 2024

What this PR does / why we need it:
This commit resolves an error "Failed copying a file because a directory
exists at the target path" which was a regression introduced in #6430.

Which issue(s) this PR fixes:

Fixes #6456

This commit resolves an error "Failed copying a file because a directory
exists at the target path" which was a regression introduced in #6430.

Fixes #6456
@stefreak stefreak requested a review from vvagaytsev September 25, 2024 14:54
// If target is a directory or source is a symbolic link and deletes are allowed, delete the target before copying, otherwise throw
if (toStats.isDirectory() || fromStats.isSymbolicLink()) {
// If target is a directory and deletes are allowed, delete the target before copying, otherwise throw
if (toStats.isDirectory()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change caused the regression. If target is a symbolic link, we must overwrite it even if allowDelete is false.

- Do not ignore symlinks whose target does not exist. These symlinks are
  perfectly valid.
- Ignore relative symlinks that point outside of the repository, even if
  they do not start with ..
@stefreak stefreak requested a review from thsig September 25, 2024 16:03
@vvagaytsev vvagaytsev added this pull request to the merge queue Sep 26, 2024
Merged via the queue into main with commit a7f0420 Sep 26, 2024
40 checks passed
@vvagaytsev vvagaytsev deleted the fix-6456 branch September 26, 2024 14:38
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.

[Bug]: Failed copying a file because a directory exists at the target path
2 participants