0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed subscribers app when missing location

no-issue

The previous version of url-utils's absoluteToRelative function had some
implicit behaviour that was relied on here. Namely that when passed an
empty string as the url AND the withoutSubdirectory option set to true,
we would end up calling the `replace` method on `null` - this would
throw an error and cause the subscribers app to enter the error handling
- which was desired behaviour.

This updates to explicitly check, and execute the error handling based
on the missing location property.
This commit is contained in:
Fabien O'Carroll 2019-08-13 12:36:05 +08:00
parent aacaa7012c
commit 4fcf313816

View file

@ -59,6 +59,9 @@ function santizeUrl(url) {
}
function handleSource(req, res, next) {
if (!req.body.location) {
return next(new Error('Missing location property'));
}
req.body.subscribed_url = santizeUrl(req.body.location);
req.body.subscribed_referrer = santizeUrl(req.body.referrer);