Issue #689 resolved

add equivalent of trailing_slash tool for static content

Anonymous created an issue

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.

Reported by Ricardo

Comments (2)

  1. Robert Brewer

    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.

  2. Log in to comment