Download number of file getting incremented on HEAD request #253

Closed
opened 2026-01-19 18:29:37 +00:00 by michael · 1 comment
Owner

Originally created by @dopessoa on GitHub.

When you send a HEAD request to a file, the counter of downloads is incremented, is this how it should be?

I guess HEAD requests souldn't count as downloads.

Steps to reproduce:

# Start the server
go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/

# Upload a file
curl -v --upload-file README.md http://localhost:8080/README.md -H "Max-Downloads: 3"

# Check the Downloads property on the .metadata file:
cat /tmp/13u1S0/README.md.metadata 
{"ContentType":"text/x-markdown; charset=utf-8","Downloads":0,"MaxDownloads":3,"MaxDate":"2029-06-06T20:49:42.895780955Z","DeletionToken":"N5cr8jgZ9B"}

# Make a HEAD request
curl -Is http://localhost:8080/13u1S0/README.md

# Check the Downloads property again
cat /tmp/13u1S0/README.md.metadata 
{"ContentType":"text/x-markdown; charset=utf-8","Downloads":1,"MaxDownloads":3,"MaxDate":"2029-06-06T20:49:42.895780955Z","DeletionToken":"N5cr8jgZ9B"}
Originally created by @dopessoa on GitHub. When you send a HEAD request to a file, the counter of downloads is incremented, is this how it should be? I guess HEAD requests souldn't count as downloads. Steps to reproduce: ``` # Start the server go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/ # Upload a file curl -v --upload-file README.md http://localhost:8080/README.md -H "Max-Downloads: 3" # Check the Downloads property on the .metadata file: cat /tmp/13u1S0/README.md.metadata {"ContentType":"text/x-markdown; charset=utf-8","Downloads":0,"MaxDownloads":3,"MaxDate":"2029-06-06T20:49:42.895780955Z","DeletionToken":"N5cr8jgZ9B"} # Make a HEAD request curl -Is http://localhost:8080/13u1S0/README.md # Check the Downloads property again cat /tmp/13u1S0/README.md.metadata {"ContentType":"text/x-markdown; charset=utf-8","Downloads":1,"MaxDownloads":3,"MaxDate":"2029-06-06T20:49:42.895780955Z","DeletionToken":"N5cr8jgZ9B"} ```
Author
Owner

@paolafrancesca commented on GitHub:

@dopessoa I think you're right. I didn't pay attention to that behaviour, I will see how to fix

@paolafrancesca commented on GitHub: @dopessoa I think you're right. I didn't pay attention to that behaviour, I will see how to fix
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#253