summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpublish13
1 files changed, 9 insertions, 4 deletions
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