From 5e45974cc533c77c148409fe637cee8f2287edcc Mon Sep 17 00:00:00 2001 From: Junoh Moon Date: Sun, 30 Apr 2023 10:26:09 +0900 Subject: [PATCH] Not rely on _urlencode function The transfer function no more relies on _urlencode function and just uploads to https://transfer.sh --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06501bd..776e19f 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ You need to create an OAuth Client id from console.cloud.google.com, download th ### Bash and zsh (multiple files uploaded as zip archive) ##### Add this to .bashrc or .zshrc or its equivalent ```bash -transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.\nUsage:\n transfer \n ... | transfer ">&2;return 1;fi;if tty -s;then file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];then file_name="$file_name.zip" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/$(_urlencode $file_name)"|tee /dev/null;else cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$(_urlencode $file_name)"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://transfer.sh/$(_urlencode $file_name)"|tee /dev/null;fi;}; _urlencode () { python3 -c 'from sys import argv, stdin; from urllib.parse import quote; print(quote(argv[1] if argv[1:] else stdin.read()))' "$@" } +transfer(){ if [ $# -eq 0 ];then echo "No arguments specified.\nUsage:\n transfer \n ... | transfer ">&2;return 1;fi;if tty -s;then file="$1";file_name=$(basename "$file");if [ ! -e "$file" ];then echo "$file: No such file or directory">&2;return 1;fi;if [ -d "$file" ];then file_name="$file_name.zip" ,;(cd "$file"&&zip -r -q - .)|curl --progress-bar --upload-file "-" "https://transfer.sh/"|tee /dev/null;else cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/"|tee /dev/null;fi;else file_name=$1;curl --progress-bar --upload-file "-" "https://transfer.sh/"|tee /dev/null;fi;} ``` #### Now you can use transfer function