diff options
author | Peter Palfrader <peter@palfrader.org> | 2012-11-29 18:46:06 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2012-11-29 18:46:06 +0000 |
commit | d678d35e6875b1ca3b8497029815ad4f8034544b (patch) | |
tree | b63be01551481ea192b6b89153e6c73110246776 | |
parent | fc859671c8a551ccf273e99ed4e4b7814ac9ee58 (diff) |
publish: Fix printing of urls with -r. Thanks to Alexander Huemer for noticing and testing
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@559 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-x | publish | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -82,7 +82,7 @@ EOF } uri_encode() { - perl -MURI::Escape -ne 'print uri_escape($_)' + perl -MURI::Escape -F/ -ape '$_ = join "/", map {uri_escape($_)} grep {!/^\.?$/} @F' } get_random() { @@ -115,6 +115,7 @@ inputxclip=0 do_screenshot=0 make_qrcode=0 add_default_cs=0 +relative="" while getopts "rhnq8HSxs:" OPTION do @@ -151,7 +152,7 @@ do name_stdin="$OPTARG" ;; r) - rsync_args="${rsync_args} --relative" + relative="--relative" ;; *) usage >&2 @@ -253,12 +254,16 @@ while [ "$#" -gt 0 ]; do file="$1" shift - uri="$base_uri""$( echo -n "`basename "$file"`" | uri_encode )" + if [ -z "$relative" ]; then + uri="$base_uri""$( echo -n "`basename "$file"`" | uri_encode )" + else + uri="$base_uri""$( echo -n $file | uri_encode )" + fi echo "$uri" history_append "$uri" rsync_pre_invoke - $NODO rsync --recursive $rsync_args "$file$trail" $base_rsync"/$d_server/" + $NODO rsync --recursive $rsync_args $relative "$file$trail" $base_rsync"/$d_server/" rsync_post_invoke done |