From d678d35e6875b1ca3b8497029815ad4f8034544b Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 29 Nov 2012 18:46:06 +0000 Subject: 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 --- publish | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'publish') diff --git a/publish b/publish index e49fb6a..f76e645 100755 --- a/publish +++ b/publish @@ -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 -- cgit v1.2.3