From fdbfe8816810f1a8703d14868e28748ce844bd15 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Aug 2017 16:20:09 -0400 Subject: [PATCH] fix external script for filenames with spaces from protocol Fix the external special remotes git-annex-remote-ipfs, git-annex-remote-torrent and the example.sh template to correctly support filenames with spaces. This commit was sponsored by John Peloquin on Patreon. --- CHANGELOG | 3 +++ doc/special_remotes/external/example.sh | 6 ++++-- doc/special_remotes/external/git-annex-remote-ipfs | 6 ++++-- doc/special_remotes/external/git-annex-remote-torrent | 6 ++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bb3a73a1cf..603b7dc653 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -31,6 +31,9 @@ git-annex (6.20170521) UNRELEASED; urgency=medium the filename parameter to the TRANSFER command could not contain spaces. It can in fact contain spaces. Special remotes implementors that relied on that may need to fix bugs in their special remotes. + * Fix the external special remotes git-annex-remote-ipfs, + git-annex-remote-torrent and the example.sh template to correctly + support filenames with spaces. -- Joey Hess Sat, 17 Jun 2017 13:02:24 -0400 diff --git a/doc/special_remotes/external/example.sh b/doc/special_remotes/external/example.sh index 8fed9f4aa3..ed37ad9ecd 100755 --- a/doc/special_remotes/external/example.sh +++ b/doc/special_remotes/external/example.sh @@ -122,9 +122,11 @@ while read line; do fi ;; TRANSFER) + op="$2" key="$3" - file="$4" - case "$2" in + shift 3 + file="$@" + case "$op" in STORE) # Store the file to a location # based on the key. diff --git a/doc/special_remotes/external/git-annex-remote-ipfs b/doc/special_remotes/external/git-annex-remote-ipfs index c8d97ef5c8..f255f9bc59 100755 --- a/doc/special_remotes/external/git-annex-remote-ipfs +++ b/doc/special_remotes/external/git-annex-remote-ipfs @@ -81,9 +81,11 @@ while read line; do echo CHECKURL-CONTENTS UNKNOWN "$(urltoaddress "$url")" ;; TRANSFER) + op="$2" key="$3" - file="$4" - case "$2" in + shift 3 + file="$@" + case "$op" in STORE) addr=$(ipfs add -q "$file"