superstatic
superstatic copied to clipboard
replaced slasher functionality
Fixes the issue encountered in #231.
glob-slasher replaces /s in the source with \s (at least on Windows) which results in URLs not matching against the given source pattern.
For example the following source /embed/:id/:ft is transformed into \embed\:id\:ft which fails the following condition this.source.match(/(?:^|\/):/).
This commit passes all tests in test/unit/middleware/redirects.spec.js so I think I have covered all three cases for the source:
- source starts with
/| do nothing - source starts with
!but does not have a leading slash | add slash after! - source does not have a leading slash | add a leading slash