Fix silent failure on invalid redirect syntax #148
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! I'm a new (happy) Pico user who recently tried to set up a redirection for my pgs site like this: https://pico.sh/pgs#redirect-www-to-naked-domain
I found there was an off-by-one error in the parsing of
_redirectsfiles that caused thethe destination path/URL must start with '/', 'http:' or 'https:validation to never trigger.If there is no valid "To Part" in the string, but the "From Part" was valid, the previous code would use the "From Part" as the "To Part". For example, the version in the docs
/* naked-domain.com 301would be parsed asFrom: "/*" , To: "/*", Status: 301The updated code throws an error, which I guess would become a 502 error. I've also updated the docs in another PR: picosh/docs#5