Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

« Content-Disposition : filename="filename.ext" » handling #40

Open
ejemba opened this issue Oct 29, 2015 · 1 comment
Open

« Content-Disposition : filename="filename.ext" » handling #40

ejemba opened this issue Oct 29, 2015 · 1 comment

Comments

@ejemba
Copy link

ejemba commented Oct 29, 2015

Given the following

$ bat -download=true http://127.0.0.1:8080/3,0140231f47.jpg
HTTP/1.1 200 OK
Last-Modified : Thu, 29 Oct 2015 13:06:15 GMT
Date : Thu, 29 Oct 2015 13:33:31 GMT
Accept-Ranges : bytes
Content-Disposition : filename="dog-spoon-lobster.jpg"
Content-Length : 70059
Content-Type : image/jpeg
Etag : "d1ca1636"

Downloading to ""dog-spoon-lobster.jpg""
68.42 KB / 68.42 KB 

The file resulting is literaly "dog-spoon-lobster.jpg" it should have been dog-spoon-lobster.jpg

$ ls -l
total 184
-rw-r--r-- 1 me users 70059 29 oct.  14:33 "dog-spoon-lobster.jpg"

It looks like Content-Disposition does not remove double quotes ?

@nicr9
Copy link
Contributor

nicr9 commented Apr 29, 2016

I put together a simple python script to repro this. It's a simple http file server that forces the Content-Disposition header to be included.

# Download script from gist: https://gist.github.com/nicr9/d3d0a96f39c4ac7956dfad74b5b411c6
$ wget -O content_disposition.py https://gist.githubusercontent.com/nicr9/d3d0a96f39c4ac7956dfad74b5b411c6/raw/89eb60f547285fb7993cf61940a29e1d83bddc87/content_disposition.py

# Run file server in cwd
$ python content_disposition.py &

# Download server file
$ bat -download http://localhost:8000/content_disposition.py

# Check that the filename is wrapped in quotes:
$ ls -alF \"*\"
-rw-rw-r-- 1 nic nic 450 Apr 29 21:47 "content_disposition.py"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants