You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a minor inconsistency that I just noticed. Yesod's default cleanPath will eliminate trailing slashes and the user will be redirected to the clean version. The wai-app-static library has a directory listing feature. So, if I use this:
The directory listing is on and I should be able to freely use my web browser to poke around in the static subsite. But, there is a trap. Unfortunately, wai-app-static has a different idea of what a "clean" path is. In particular, if you try to browse a directory, it wants to add a slash to the path. This means that combining this feature with Yesod's defaults gives us a redirect loop. The fix is obvious:
cleanPath _ s = if corrected == s || headMay s == Just "mystatic"
then Right $ map dropDash s
else Left corrected
where
corrected = filter (not . Text.null) s
dropDash t
| Text.all (== '-') t = Text.drop 1 t
| otherwise = t
But, I feel like the two should work together by default. Maybe a change to wai-app-static would be appropriate because I really do like that Yesod drops the trailing slashes. Any thoughts?
The text was updated successfully, but these errors were encountered:
If I could choose a convention without thinking about how it would be implemented, I'd say that wai-app-static should continue adding trailing slashes to directories while the rest of the Yesod web app should continue to be able to choose whether their routes contain trailing slashes or not.
However, knowing the details of how subsites are setup, the easiest solution is probably to make a switch on wai-app-static disabling all redirects due to trailing slashes, and make this the default. The application containing the wai-app-static subsite is then able to choose whatever convention for everything.
This is a minor inconsistency that I just noticed. Yesod's default
cleanPath
will eliminate trailing slashes and the user will be redirected to the clean version. The wai-app-static library has a directory listing feature. So, if I use this:The directory listing is on and I should be able to freely use my web browser to poke around in the static subsite. But, there is a trap. Unfortunately,
wai-app-static
has a different idea of what a "clean" path is. In particular, if you try to browse a directory, it wants to add a slash to the path. This means that combining this feature with Yesod's defaults gives us a redirect loop. The fix is obvious:But, I feel like the two should work together by default. Maybe a change to wai-app-static would be appropriate because I really do like that Yesod drops the trailing slashes. Any thoughts?
The text was updated successfully, but these errors were encountered: