Repository navigation
Conversation
keepLatestNBackups interpolated the backup S3 path unquoted into the
rclone lsf/delete shell commands. Backup prefixes are free-form user
input, so a prefix with spaces or other shell-special characters made
the shell split the path and the retention cleanup silently failed.
Quote the path in both commands, keeping the xargs {} placeholder
inside the quotes so substituted paths stay a single argument.
Extracted the command builder into getKeepLatestNBackupsCommand for
testability; keepLatestNBackups behavior is unchanged.
…etention-quote-s3-path
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 broke
keepLatestNBackups(the retention cleanup that runs after every backup, on the panel server and on remote servers) built itsrclone lsfandrclone deleteshell commands with the S3 destination path interpolated unquoted. Every other rclone invocation in the codebase double-quotes the destination.Root cause
Backup prefixes are free-form user input (schema:
z.string().min(1)), so a prefix containing spaces or other shell-special characters made the shell split the path into multiple arguments. rclone then received a wrong path, and since the function swallows its own errors (try/catch -> console.error), the retention cleanup failed silently instead of pruning old backups.Related to #4354, which reports backup failures when the backup name/prefix contains certain characters.
What changed
getKeepLatestNBackupsCommandinpackages/server/src/utils/backups/utils.ts.rclone lsfandrclone deletecommands, keeping the xargs{}placeholder inside the quotes so substituted paths stay a single argument.keepLatestNBackupsnow uses the builder; its behavior is otherwise unchanged.Verification
apps/dokploy/__test__/backups/keep-latest-n-backups.test.ts(5 tests): runs the generated pipeline through a real shell with a stub rclone that records its argv. Before the fix, the two space-in-prefix tests failed (path split into two arguments); after the fix, all 5 pass.tsc --noEmitclean inpackages/server; Biome check clean on touched files.The PR appears safe to merge.
What we checked:
Summary
Backup retention now quotes the S3 path in both rclone commands, keeping prefixes with spaces together. The command builder is reused by local and remote cleanup and covered by shell-based regression tests.
Reviews (1) · Last reviewed commit: "fix(server): quote S3 path in backup ret..."