diff --git a/ghost/core/core/server/services/url/UrlGenerator.js b/ghost/core/core/server/services/url/UrlGenerator.js index 8d95dc86c0..5320756b85 100644 --- a/ghost/core/core/server/services/url/UrlGenerator.js +++ b/ghost/core/core/server/services/url/UrlGenerator.js @@ -170,11 +170,10 @@ class UrlGenerator { return false; } - const url = this._generateUrl(resource); - // CASE 1: route has no custom filter, it will own the resource for sure // CASE 2: find out if my filter matches the resource if ((!this.filter) || (this.nql.queryJSON(resource.data))) { + const url = this._generateUrl(resource); this.urls.add({ url: url, generatorId: this.uid, diff --git a/ghost/core/test/unit/server/services/url/UrlGenerator.test.js b/ghost/core/test/unit/server/services/url/UrlGenerator.test.js index 0237c9f7ce..50db171493 100644 --- a/ghost/core/test/unit/server/services/url/UrlGenerator.test.js +++ b/ghost/core/test/unit/server/services/url/UrlGenerator.test.js @@ -263,7 +263,7 @@ describe('Unit: services/url/UrlGenerator', function () { urlGenerator._try(resource); - urlGenerator._generateUrl.calledOnce.should.be.true(); + urlGenerator._generateUrl.calledOnce.should.be.false(); urlGenerator._resourceListeners.called.should.be.false(); urls.add.called.should.be.false(); resource.reserve.called.should.be.false();