diff --git a/.zsh/functions.zsh b/.zsh/functions.zsh index 736fa68..9bc9020 100644 --- a/.zsh/functions.zsh +++ b/.zsh/functions.zsh @@ -15,16 +15,17 @@ upload() { # make eternity the default lifespan FILE_LIFESPAN=${2:-e} FILE_ID=$(base64 /dev/urandom | tr -d '/+' | dd bs=16 count=1 2>/dev/null) + FILENAME=$(basename $1) - rsync -auvP -4 $1 nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1 + rsync -auvP -4 $1 "nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$FILENAME" - FILE_URL="https://dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1" + FILE_URL="https://dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$FILENAME" if [[ -z "$WAYLAND_DISPLAY" ]]; then echo $FILE_URL | xclip -selection clipboard echo $FILE_URL | xsel --clipboard --input else - echo $FILE_URL | wl-copy + wl-copy --trim-newline $FILE_URL fi echo $FILE_URL