Open korny-babylon opened 5 years ago
Yes, I see your point, but I don't see a very good modification point in the code to allow it. Could you work around this by creating the CNAME-file where you are calling stasis.core/export-pages
?
I've just run into this as well (not specifically with a github CNAME file, but a resource that should not have an "extension"). I see the original commit that added this check (https://github.com/magnars/stasis/commit/fabc8f217ddd18f42f08a648e36af645951a11b2) and I'm a little confused. URIs are just endpoints and a server can choose to do what it wants with them, so this seems to be a fairly significant limitation/requirement.
Can we only fallback to redirecting to the /page
to /page/
after we've checked if there is a page for that URI at https://github.com/magnars/stasis/blob/master/src/stasis/core.clj#L108? e.g.
(if (and (nil? (pages (:uri request)))
(not (statically-servable-uri? (:uri request)))
{:status 301, :headers {"Location" (str (:uri request) "/")}}
...)
If you're fine with that, I can open a PR
I went ahead and opened a PR (https://github.com/magnars/stasis/pull/25). Let me know your thoughts.
Github pages, when using a custom domain, expects a file called
CNAME
in the root of your site - however magnars deliberately doesn't allow publishing a file with no extension, it returns an error:The following page paths must end in a slash: ("/CNAME")
It would be good to be able to whitelist special cases such as this, somehow.