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

Give original filename to HTTP clients on download request for certain compression formats #32

Open
wareya opened this issue May 5, 2015 · 13 comments

Comments

@wareya
Copy link

wareya commented May 5, 2015

Some compression formats (bz2, etc) compress a single file where the contained file is named after the archive itself. For example, "gamearchive.packme.bz2" decompresses to a file called whatever is to the left of the bz2 extension. This isn't a problem for nested archives (such as tar.gz) but it can make some single-file uploads useless due to losing the filename unless they encapsulate the archive in another useless file or vice versa.

@thehowl
Copy link

thehowl commented May 5, 2015

this would require a php script to be executed for each request, which obviously slows down the downloading of the files and puts some unnecessary server load.

On 5 May 2015 05:44:36 CEST, Alexander Nadeau [email protected] wrote:

Some compression formats (bz2, etc) compress a single file where the
contained file is named after the archive itself. For example,
"gamearchive.packme.bz2" decompresses to a file called whatever is to
the left of the bz2 extension. This isn't a problem for nested archives
(such as tar.gz) but it can make some single-file uploads useless due
to losing the filename unless they encapsulate the archive in another
useless file or vice versa.


Reply to this email directly or view it on GitHub:
#32

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@wareya
Copy link
Author

wareya commented May 5, 2015

Good response.

It makes me wonder if there's another way to do it. I know that some sites out there have a suffix on the URL which denotes the download filename, but as you said implementing it in an easy way would be a problem.

@thehowl
Copy link

thehowl commented May 5, 2015

well, i do know there's already a way for it that is being used for .tar.gz and some, here: https://github.com/nokonoko/Pomf/blob/master/static/includes/settings.inc.php

check the array at the bottom.

On 5 May 2015 10:47:20 CEST, Alexander Nadeau [email protected] wrote:

Good response.

It makes me wonder if there's another way to do it. I know that some
sites out there have a suffix on the URL which denotes the download
filename, but as you said implementing it in an easy way would be a
problem.


Reply to this email directly or view it on GitHub:
#32 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@wareya
Copy link
Author

wareya commented May 5, 2015

That seems to work at upload time, no?

Anyways, I think a partial solution would be script that's separate from the normal download method specifically for people who need to post links that generate the original filename. Something like a url of /alias/cllzda.bz2/gamearchive.packme.bz2

Dunno, depends how the servers are set up.

@thehowl
Copy link

thehowl commented May 5, 2015

yeah, and what would be the problem? it still saves them with the full extension rather than only .gz and such

anyway, i guess the alias would actually be possible. it would just put a small load on nginx due to regex rewrites but that's definetely possible.

maybe it could be on another subdomain specific for alias, so that it doesn't affect the main a.pomf.se.

On 5 May 2015 11:41:16 CEST, Alexander Nadeau [email protected] wrote:

That seems to work at upload time, no?

Anyways, I think a partial solution would be script that's separate
from the normal download method specifically for people who need to
post links that generate the original filename. Something like
/alias/cllzda.bz2/gamearchive.packme.bz2


Reply to this email directly or view it on GitHub:
#32 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@wareya
Copy link
Author

wareya commented May 5, 2015

Doing that at upload time is good for paired extension like tar.gz, but over here it would maybe just be useful for changing the kind of URL that the uploader receives when they're done.

anyway, i guess the alias would actually be possible. it would just put a small load on nginx due to regex rewrites but that's definetely possible.

hiding the functionality behind an FAQ, cheat sheet, or activating it based on what kind of file was uploaded like above would go a ways to making sure only people who actually need it use a function like this

maybe it could be on another subdomain specific for alias, so that it doesn't affect the main a.pomf.se.

Good idea.

@nokonoko
Copy link
Owner

nokonoko commented May 5, 2015

I'll look into it, very busy atm.

A easy solution would be to detect archive formats and store their original filename and give back a download link such as a.pomf.se/RAND_STRING/arch.1.ext.

That way the file will still be useable and not having to dabble around with extra subdomains.

@NuckChorris
Copy link
Collaborator

What about just when it ends in .gz read back to the previous dot as the kept extension?

@wareya
Copy link
Author

wareya commented May 6, 2015

Thanks @nokonoko

@NuckChorris sometimes people have files without proper extensions or non-extensions after a dot

@NuckChorris
Copy link
Collaborator

If it doesn't have an extension before the .gz, maintaining the file name will do nothing. If it does, that will fix it.

As for not-extension-but-has-dot, can you think of any situation where a .gz file with another dot earlier in the name isn't the extension?

@wareya
Copy link
Author

wareya commented May 7, 2015

If it doesn't have an extension before the .gz, maintaining the file name will do nothing.

Sometimes the filename itself has semantic meaning.

As for not-extension-but-has-dot, can you think of any situation where a .gz file with another dot earlier in the name isn't the extension?

For example, hidden files on unix systems? People do crazy things with filenames; extensions-after-dots are just a very useful tradition of sorts

@NuckChorris
Copy link
Collaborator

I agree that pond should replay the file name on download, but I'm pointing out that most non-semantic issues could be solved by reading back to the previous dot.

I keep saying pomf needs a server to do X-Sendfile

@wareya
Copy link
Author

wareya commented May 7, 2015

Looks like we're in agreement

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

4 participants