
Here's an opinion question for the web-devel list. In Yesod, I try to ensure that we keep a single canonical URL for each resource, and redirect non-canonical URL there. For example: /foo/bar ---> /foo/bar/ /foo//bar/ ---> /foo/bar/ /static/myfile.png/ ---> /static/myfile.png There are essentially two components to this cleanup: collapsing multiple slashes and dealing with the trailing slash. If you pay careful attention to the example above, you'll notice that there's a subtlety to this trailing slash rule: * If the last piece of the URL contains a period, it is assumed to be a filename + extension, and therefore no trailing slash is used. * Otherwise, a trailing slash is used. My question is whether people would prefer a different default rule. (I say default because you can easily override this setting using the splitPath and joinPath functions.) The other two rules I could think of are always requiring or always banning the trailing slash. I think the former will make filenames look strange, but I don't really have a strong feeling on the latter. So the question is, what do y'all think? Cheers, Michael

On 20 September 2010 16:17, Michael Snoyman
My question is whether people would prefer a different default rule. (I say default because you can easily override this setting using the splitPath and joinPath functions.) The other two rules I could think of are always requiring or always banning the trailing slash. I think the former will make filenames look strange, but I don't really have a strong feeling on the latter.
Seems reasonable. I don't think a trailing slash is so important a distinction as a file extension, but it doesn't seem to hurt either. If this is purely about presentation and not a technical issue I'd go along with what you describe here. I go with the same distinction in my own applications.
participants (2)
-
Christopher Done
-
Michael Snoyman