Unable to delete and no token on curl #111

Closed
opened 2026-01-19 18:29:00 +00:00 by michael · 4 comments
Owner

Originally created by @barart on GitHub.

Im self-hosting transfer.sh using a doker container, i can upload files from browser and using curl and i can get the file, browser show the download link also curl, also i can see the files on my server but i cant delete those files from curl or browser let me explain:

If i upload a file from browser i can get my deletion token, if i go to http://ip:port/yF126n/file/deletiontoken i just see a empty page but if i go to my server i can see the files there, the log just show this:
[transfer.sh]2022/05/04 01:48:42 myip:56463 - - [2022-05-04T01:48:42Z] "GET /yF126n/storm.PNG/deletetoken HTTP/1.1" 405 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"

if i try to delete the file using curl the file do not delete and i get no response from curl, the log show this:
[transfer.sh]2022/05/04 01:53:43 myip:51674 - - [2022-05-04T01:53:43Z] "DELETE /yF126n/storm.PNG/deletetoken HTTP/1.1" 0 "" "curl/7.74.0"

If i upload a file from curl the file upload fine but curl dont return my delete token just the download link:
user@server:~ $ curl --upload-file ./test http://ip:port
http://ip:port/KVHtU3/testuser@server:~ $

Do i missed a configuration or something? im using the latest release

Originally created by @barart on GitHub. Im self-hosting transfer.sh using a doker container, i can upload files from browser and using curl and i can get the file, browser show the download link also curl, also i can see the files on my server but i cant delete those files from curl or browser let me explain: If i upload a file from browser i can get my deletion token, if i go to http://ip:port/yF126n/file/deletiontoken i just see a empty page but if i go to my server i can see the files there, the log just show this: [transfer.sh]2022/05/04 01:48:42 myip:56463 - - [2022-05-04T01:48:42Z] "GET /yF126n/storm.PNG/deletetoken HTTP/1.1" 405 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0" if i try to delete the file using curl the file do not delete and i get no response from curl, the log show this: [transfer.sh]2022/05/04 01:53:43 myip:51674 - - [2022-05-04T01:53:43Z] "DELETE /yF126n/storm.PNG/deletetoken HTTP/1.1" 0 "" "curl/7.74.0" If i upload a file from curl the file upload fine but curl dont return my delete token just the download link: user@server:~ $ curl --upload-file ./test http://ip:port http://ip:port/KVHtU3/testuser@server:~ $ Do i missed a configuration or something? im using the latest release
Author
Owner

@paolafrancesca commented on GitHub:

For some reason if i do a ls on yF126n with my current user i got this:

file are created with only owner permission

I see that the directory is empty (so i think the files are gone?) but directory stills there

yes, only the files are delete, not the directory

@paolafrancesca commented on GitHub: > For some reason if i do a ls on yF126n with my current user i got this: file are created with only owner permission > I see that the directory is empty (so i think the files are gone?) but directory stills there yes, only the files are delete, not the directory
Author
Owner

@barart commented on GitHub:

Ok, i have a last question, is there a database or something where the delete token and file history are stored? I mean, if a user forgot his delete token can i just delete the files manually or i need to delete ? can i also delete the folders?

@barart commented on GitHub: Ok, i have a last question, is there a database or something where the delete token and file history are stored? I mean, if a user forgot his delete token can i just delete the files manually or i need to delete ? can i also delete the folders?
Author
Owner

@paolafrancesca commented on GitHub:

hello @barart

If i upload a file from browser i can get my deletion token, if i go to http://ip:port/yF126n/file/deletiontoken i just see a empty page but if i go to my server i can see the files there, the log just show this:
[transfer.sh]2022/05/04 01:48:42 myip:56463 - - [2022-05-04T01:48:42Z] "GET /yF126n/storm.PNG/deletetoken HTTP/1.1" 405 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0"

you are making a GET request instead of a DELETE one when opening the url in the browser. having an empty 405 (method not allowed) response is correct

if i try to delete the file using curl the file do not delete and i get no response from curl, the log show this: [transfer.sh]2022/05/04 01:53:43 myip:51674 - - [2022-05-04T01:53:43Z] "DELETE /yF126n/storm.PNG/deletetoken HTTP/1.1" 0 "" "curl/7.74.0"

this is strange, the request is a DELETE one, the file should be deleted. having an empty response is correct, but the file should be deleted as well.

I wonder if running on docker can be the problem: what is your --basedir value? is it on a volume shared with docker? does it have the proper permissions? can you share an ls -lah of {basedir}/yF126n?

If i upload a file from curl the file upload fine but curl dont return my delete token just the download link:

the donwload link is returned as header, you must tell curl to output the response headers:
curl -v --upload-file hello.txt https://transfer.sh

< HTTP/2 200
< server: nginx/1.14.2
< date: Wed, 04 May 2022 02:51:53 GMT
< content-type: text/plain
< content-length: 36
< retry-after: Wed, 04 May 2022 04:51:56 GMT
< x-made-with: <3 by DutchCoders
< x-ratelimit-key: 127.0.0.1,114.30.12.249,114.30.12.249
< x-ratelimit-limit: 10
< x-ratelimit-rate: 600
< x-ratelimit-remaining: 9
< x-ratelimit-reset: 1651632716
< x-served-by: Proudly served by DutchCoders
< x-url-delete: https://transfer.sh/IJmsUv/hello.txt/T3gVRiodma1w
< strict-transport-security: max-age=63072000

see x-url-delete: https://transfer.sh/IJmsUv/hello.txt/T3gVRiodma1w

@paolafrancesca commented on GitHub: hello @barart > If i upload a file from browser i can get my deletion token, if i go to http://ip:port/yF126n/file/deletiontoken i just see a empty page but if i go to my server i can see the files there, the log just show this: > [transfer.sh]2022/05/04 01:48:42 myip:56463 - - [2022-05-04T01:48:42Z] "GET /yF126n/storm.PNG/deletetoken HTTP/1.1" 405 "" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0" you are making a `GET` request instead of a `DELETE` one when opening the url in the browser. having an empty `405` (method not allowed) response is correct > if i try to delete the file using curl the file do not delete and i get no response from curl, the log show this: [transfer.sh]2022/05/04 01:53:43 myip:51674 - - [2022-05-04T01:53:43Z] "DELETE /yF126n/storm.PNG/deletetoken HTTP/1.1" 0 "" "curl/7.74.0" this is strange, the request is a `DELETE` one, the file should be deleted. having an empty response is correct, but the file should be deleted as well. I wonder if running on docker can be the problem: what is your `--basedir` value? is it on a volume shared with docker? does it have the proper permissions? can you share an `ls -lah` of `{basedir}/yF126n`? > If i upload a file from curl the file upload fine but curl dont return my delete token just the download link: the donwload link is returned as header, you must tell curl to output the response headers: `curl -v --upload-file hello.txt https://transfer.sh` ``` < HTTP/2 200 < server: nginx/1.14.2 < date: Wed, 04 May 2022 02:51:53 GMT < content-type: text/plain < content-length: 36 < retry-after: Wed, 04 May 2022 04:51:56 GMT < x-made-with: <3 by DutchCoders < x-ratelimit-key: 127.0.0.1,114.30.12.249,114.30.12.249 < x-ratelimit-limit: 10 < x-ratelimit-rate: 600 < x-ratelimit-remaining: 9 < x-ratelimit-reset: 1651632716 < x-served-by: Proudly served by DutchCoders < x-url-delete: https://transfer.sh/IJmsUv/hello.txt/T3gVRiodma1w < strict-transport-security: max-age=63072000 ``` see `x-url-delete: https://transfer.sh/IJmsUv/hello.txt/T3gVRiodma1w`
Author
Owner

@barart commented on GitHub:

Hello @aspacca

Thanks for your reply,

I wonder if running on docker can be the problem: what is your --basedir value? is it on a volume shared with docker? does it have the proper permissions? can you share an ls -lah of {basedir}/yF126n?

My --basedir value is --basedir=/transfers and yes is in a volume shared and i think it has the proper permissions, im running it as -nonroot so user (according to your manual) is 5000 my docker Volume has this values:

Host/volume                                                                  Path in container
/home/transfersh/transfers                                              /transfers

This are my ls outputs:


$ ls -lah /home
total 16K
drwxr-xr-x  4 root root 4.0K May  2 20:52 .
drwxr-xr-x 21 root root 4.0K Apr 26 20:44 ..
drwxr-xr-x  4 5000 5000 4.0K May  2 20:58 transfersh

$ ls -lah /home/transfersh/transfers
total 16K
drwxr-xr-x 4 5000 5000 4.0K May  3 20:56 .
drwxr-xr-x 4 5000 5000 4.0K May  2 20:58 ..
drwx------ 2 5000 5000 4.0K May  3 20:56 KVHtU3
drwx------ 2 5000 5000 4.0K May  3 20:53 yF126n

For some reason if i do a ls on yF126n with my current user i got this:

$ ls -lah /home/transfersh/transfers/yF126n
ls: cannot open directory '/home/transfersh/transfers/yF126n': Permission denied

I need to sudo the command, in order to ls the directory:


$ sudo ls -lah /home/transfersh/transfers/yF126n
total 8.0K
drwx------ 2 5000 5000 4.0K May  3 20:53 .
drwxr-xr-x 4 5000 5000 4.0K May  3 20:56 ..

I see that the directory is empty (so i think the files are gone?) but directory stills there, that's why I thought the files had not been deleted, i just make another test and i can confirm that files are gone but directory still there

@barart commented on GitHub: Hello @aspacca Thanks for your reply, > I wonder if running on docker can be the problem: what is your --basedir value? is it on a volume shared with docker? does it have the proper permissions? can you share an ls -lah of {basedir}/yF126n? My --basedir value is `--basedir=/transfers` and yes is in a volume shared and i think it has the proper permissions, im running it as `-nonroot` so user (according to your manual) is `5000` my docker Volume has this values: ``` Host/volume Path in container /home/transfersh/transfers /transfers ``` This are my ls outputs: ``` $ ls -lah /home total 16K drwxr-xr-x 4 root root 4.0K May 2 20:52 . drwxr-xr-x 21 root root 4.0K Apr 26 20:44 .. drwxr-xr-x 4 5000 5000 4.0K May 2 20:58 transfersh $ ls -lah /home/transfersh/transfers total 16K drwxr-xr-x 4 5000 5000 4.0K May 3 20:56 . drwxr-xr-x 4 5000 5000 4.0K May 2 20:58 .. drwx------ 2 5000 5000 4.0K May 3 20:56 KVHtU3 drwx------ 2 5000 5000 4.0K May 3 20:53 yF126n ``` For some reason if i do a ls on yF126n with my current user i got this: ``` $ ls -lah /home/transfersh/transfers/yF126n ls: cannot open directory '/home/transfersh/transfers/yF126n': Permission denied ``` I need to sudo the command, in order to ls the directory: ``` $ sudo ls -lah /home/transfersh/transfers/yF126n total 8.0K drwx------ 2 5000 5000 4.0K May 3 20:53 . drwxr-xr-x 4 5000 5000 4.0K May 3 20:56 .. ``` I see that the directory is empty (so i think the files are gone?) but directory stills there, that's why I thought the files had not been deleted, i just make another test and i can confirm that files are gone but directory still there
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#111