0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00
ghost/test
Fabien O'Carroll c5b8dab523 🐛 Fixed custom redirects for subdirectory setups
no-issue

This issue only occurs when using custom redirects with a subdirectory
setup, and the path to be redirected from is expressed as a regex, and
the url that is being redirected to is not an external url.

The issue has a few components:

- Redirect paths as a regex generally use the ^ to ensure that they
  match the beginning of the path.

- The path that the regex is matched against conditionally excludes the
  subdirectory, specifically, the subdirectory is excluded for external
  urls

These combined means you end up with a regex like /^\/custom-redirect/
and a path like /subdir/custom-redirect, these will not match/replace
correctly, and you'll end in an infinite redirect loop.

The fix here is to *always* remove the subdirectory when testing regex's
and then conditionally adding it back *only* for the redirect, and only
if it is an internal redirect
2020-06-16 10:24:13 +02:00
..
api-acceptance Renamed members import/export endpoints 2020-06-16 18:08:50 +12:00
frontend-acceptance Updated edit URLs to use consistent correct URLs 2020-06-01 08:42:11 +01:00
regression 🐛 Fixed custom redirects for subdirectory setups 2020-06-16 10:24:13 +02:00
unit Rework private blogging unit tests 2020-06-15 21:04:36 +01:00
utils 🐛 Fixed custom redirects for subdirectory setups 2020-06-16 10:24:13 +02:00
.eslintignore Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00
.eslintrc.json Fixed linting error 2020-04-17 11:32:29 +01:00
.jshintrc Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00