Ticket #689 (enhancement)
Opened 1 year ago
Last modified 1 year ago
add equivalent of trailing_slash tool for static content
Status: closed (fixed)
| Reported by: | Ricardo | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | CherryPy code | Keywords: | |
| Cc: |
The trailing_slash tool only affects requests for dynamic pages; it has no effect on requests for static content. But the same functionality ought to be available for static content requests as well. A quick and dirty way to achieve this effect is simply to remove the second condition in the IF test in the third last line of cherrypy.lib.static.staticdir. In other words, if that line reads just 'if index:' instead of 'if index and filename[-1] in (r"\/"):', cherrypy serves up static content just fine whether or not the URL submitted has a trailing slash. Of course, this doesn't leave the option for rejecting requests submitted without a trailing slash. If that option is deemed necessary, a proper tool would have to be constructed.
Change History
06/16/07 18:37:08: Modified by fumanchu
- status changed from new to closed.
- resolution set to fixed.


Trunk fix in [1668]. Instead of duplicating the tool, I just re-used is_index. This should be the preferred method for such tools, both builtin and custom.