Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#5727 closed (duplicate)

views/static.py small refactoring

Reported by: Thomas Güttler <hv@…> Owned by: nobody
Component: Generic views Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If you need to check permissions before allowing access to a static file, you can't use
apache/lighttpd to serve these files.

I changed views/static.py a little, so that you can use HTTP_IF_MODIFIED_SINCE
and mimetype detection for a single file.

Attachments (1)

views_static__serve_file.diff (816 bytes) - added by Thomas Güttler <hv@…> 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by Thomas Güttler <hv@…>

comment:1 Changed 8 years ago by Simon G <dev@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 8 years ago by jacob

  • Component changed from Uncategorized to Generic views

I'm not clear on what the point of this patch is. Can you clarify it for me?

comment:3 Changed 8 years ago by Thomas Güttler <hv@…>

views.static.serve() does a lot to the given path:

  • uses urllib.unquote()
  • split it by /, use os.splitdrive(), redirect if it contains '.' or '..'
  • Raise Http404 if it does not exist

I just want to server a filename. It should raise an
Exception, if it does not exist. I wanted to use
the part that checks for 'HTTP_IF_MODIFIED_SINCE', but without
the other stuff.

Feel free to close it, if you don't care. The serve() method
works for me, too.

comment:4 Changed 7 years ago by guettli

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #6485

comment:5 Changed 7 years ago by guettli

  • Cc hv@… removed
Note: See TracTickets for help on using tickets.
Back to Top