superstatic icon indicating copy to clipboard operation
superstatic copied to clipboard

replaced slasher functionality

Open HaykoKoryun opened this issue 8 years ago • 0 comments

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:

  1. source starts with / | do nothing
  2. source starts with ! but does not have a leading slash | add slash after !
  3. source does not have a leading slash | add a leading slash

HaykoKoryun avatar Dec 03 '17 14:12 HaykoKoryun