unit9 / gae-secure-scaffold-python

UNIT9's fork of GAE Secure Scaffold, for use on internal projects
Apache License 2.0
1 stars 0 forks source link

Serving audio files #5

Closed rglsk closed 8 years ago

rollcat commented 8 years ago

ok

krzysztofnowak commented 8 years ago

Code is ok but should we add all possible options? In comment you can find link with examples of all possible files https://gist.github.com/darktable/873098

rollcat commented 8 years ago

@krzysztofnowak first off, I believe there must be a smarter way to do that.

Many Linux distros have a mime type database in /etc/mime.types, but the exact contents vary between vendors and releases, plus no idea what's the case on Windows or Mac. Python also has the mimetypes module which uses the OS's database.

App Engine makes a best guess at the mimetype when none is stated explicitly, and that's why extensions for static files are enumerated in app.yaml; otherwise you could just drop a wildcard and call it a day.

Wildcard with no explicit mimetype is risky. We can't risk a silently broken deployment on some platforms. Some guy will run appcfg.py update . on his Mac and the effect may be vastly different from another guy's run on Ubuntu.

But enumerating handlers for each supported mimetype is counterproductive, bloated and useless boilerplate.

Perhaps there is a way to plug in a static mimetype database into the project, I wouldn't be surprised if GAE just used the mimetypes module under the hood.

rollcat commented 8 years ago

In the meantime the PR has my thumbs up, but I would love to have the #3 branching mess resolved before we accept anything to master.