Loggerhead doesn't support linking to the raw content
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
loggerhead |
Fix Released
|
Medium
|
Max Kanat-Alexander |
Bug Description
There are 2 bits involved.
1) Something like the 'download' link that doesn't require including the file id. For example, you can currently link to:
http://
but to download the raw content it is:
http://
Which requires the file-id. (and the path, which is a bit strange)
So updating 'download' to not require file-id would be sufficient.
2) A way to view raw content in-the-browser, rather than always being an octet stream. So 'raw' vs 'download'.
I believe there is a constraint that Launchpad imposes, that we don't want to be a generic file hosting service. (we don't want people to host all of their web images in Launchpad, and link them on their html websites.)
However, one answer there is that everything in 'raw' is either treated as 'text/plain' or 'application/
Related branches
- Martin Pool: Approve
-
Diff: 152 lines (+70/-2)3 files modifieddocs/serve-branches.rst (+18/-1)
loggerhead/apps/transport.py (+46/-1)
loggerhead/config.py (+6/-0)
- Martin Pool: Approve
-
Diff: 396 lines (+140/-60)8 files modifiedloggerhead/apps/branch.py (+2/-0)
loggerhead/controllers/__init__.py (+37/-6)
loggerhead/controllers/download_ui.py (+5/-14)
loggerhead/controllers/raw_ui.py (+60/-0)
loggerhead/controllers/view_ui.py (+16/-30)
loggerhead/static/css/files.css (+7/-0)
loggerhead/templates/inventory.pt (+9/-10)
loggerhead/templates/view.pt (+4/-0)
Changed in launchpad-code: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
affects: | launchpad-code → loggerhead |
Changed in loggerhead: | |
assignee: | nobody → Max Kanat-Alexander (mkanat) |
status: | Confirmed → In Progress |
Changed in loggerhead: | |
status: | In Progress → Fix Committed |
Changed in loggerhead: | |
status: | Fix Committed → Fix Released |
What I've done is I've added a "raw" controller that actually attempts to do its best to serve files with the right MIME type. It's remarkably fast--about 0.05 seconds to get a file's entire content and all associated information, even on a large branch like launchpad.
What I haven't yet done is added XSS protection, which is something I may do in a follow-up bug, since the work required for this was complex enough as it is.