fix(backups): Fix deleting all backups instead of keeping n latest#3856
Open
jirkavrba wants to merge 1 commit intoDokploy:canaryfrom
Open
fix(backups): Fix deleting all backups instead of keeping n latest#3856jirkavrba wants to merge 1 commit intoDokploy:canaryfrom
jirkavrba wants to merge 1 commit intoDokploy:canaryfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR about?
Fix backup deleting all existing backups, not just the x latest.
Described in the issue #3855
Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
closes #3855
Screenshots (if applicable)
Greptile Summary
This PR fixes a critical bug where
path.join()was used to construct S3 paths in the backup cleanup logic. The Node.jspath.join()function is designed for filesystem paths and causes issues with S3 URLs: if the prefix contains a leading slash,path.join()treats it as an absolute path and discards the bucket portion, resulting in an invalid S3 path. This could cause rclone to fail or behave incorrectly when deleting old backups.The fix:
normalizeS3Path()which properly handles S3 path semantics (removes leading/trailing slashes, adds trailing slash)path.join()No issues found. The implementation is clean and the
normalizeS3Path()function properly handles edge cases.Confidence Score: 5/5
path.join()(designed for filesystem paths) withnormalizeS3Path()(designed for S3 paths). The implementation is straightforward, uses existing utility functions, and doesn't introduce new complexity or side effects. The change is well-scoped to the problematic code path.Last reviewed commit: bf9d019
(5/5) You can turn off certain types of comments like style here!