Skip to content

fix: strip double quotes from sftp.args flags to prevent restic parse error#1237

Open
wahajahmed010 wants to merge 1 commit into
garethgeorge:mainfrom
wahajahmed010:fix/1227-sftp-args-quoting
Open

fix: strip double quotes from sftp.args flags to prevent restic parse error#1237
wahajahmed010 wants to merge 1 commit into
garethgeorge:mainfrom
wahajahmed010:fix/1227-sftp-args-quoting

Conversation

@wahajahmed010
Copy link
Copy Markdown

Fixes #1227

Problem

When configuring an SFTP repository with custom sftp.args containing quoted paths, Backrest 1.13.0 generates an invalid --option=sftp.args=... flag that restic cannot parse:

invalid argument "sftp.args=..." for "-o, --option" flag: parse error on line 1, column 30: bare " in non-quoted-field

This prevents users from modifying or saving SFTP repository configurations.

Fix

Updated sanitizeRepoFlags to strip double quotes from sftp.args values. Double quotes are not needed in the sftp.args context because restic passes these values directly to the sftp command. The -i @ workaround is preserved.

Added TestSanitizeRepoFlags with coverage for quote stripping, the -i @ workaround, and edge cases.

… error

The UI constructs sftp.args flags with double-quoted paths (e.g.
-i "/root/.ssh/key"), which causes restic's pflag parser to fail
with 'bare " in non-quoted-field'. The sanitizeRepoFlags function
now strips double quotes from sftp.args values since they are not
needed when passed as sftp subcommand arguments.

Fixes garethgeorge#1227
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Wahaj Ahmed seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Backrest 1.13.0 generates invalid sftp.args quoting for restic SFTP repositories

2 participants