Open snowphone opened 1 year ago
hi @snowphone , thanks for the PR
please, see my comment at https://github.com/dutchcoders/transfer.sh/issues/546#issuecomment-1528347712
the best solution would be to avoid cat
and do not add the filename in the url
cat "$file"|curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"
vs
curl --progress-bar --upload-file "$file" "https://transfer.sh/"
so no need for urlencode and $file_name
Wow it's too simple 😂 I changed this PR as you advised.
Add URL encoding functionality to the
transfer
function inREADME.md
so that file names with spaces can be uploaded correctly (e.g.hello world.json
).Also, the code uses the
_urlencode
function written in Python3. I know not every *nix OS includes Python3 by default but I'm familiar with Python and I don't know how to make it more portable.This commit includes changes to the following:
transfer
function to use_urlencode
for encoding the file names as URL._urlencode
function to URL encode the file names.Since this oneliner is too hard to review, I uploaded formatted code too: before.txt after.txt
If this PR is okay, I'll make a PR to tranfer.sh-web too