From 20f102808a501fbd5654b27563871464c9c87837 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 20 Dec 2015 14:46:43 +0000 Subject: [PATCH] Switch channel filters to use strings not literals fixes #6247 - GQL has a bug where literals starting with numbers are incorrectly parsed - Using strings instead of literals is a workaround, but is probably safer anyway --- core/server/controllers/frontend/channel-config.js | 4 ++-- core/test/unit/rss_spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/server/controllers/frontend/channel-config.js b/core/server/controllers/frontend/channel-config.js index e00166e3d3..abed7a98cd 100644 --- a/core/server/controllers/frontend/channel-config.js +++ b/core/server/controllers/frontend/channel-config.js @@ -13,7 +13,7 @@ getConfig = function getConfig(name) { name: 'tag', route: '/' + config.routeKeywords.tag + '/:slug/', postOptions: { - filter: 'tags:%s' + filter: 'tags:\'%s\'' }, data: { tag: { @@ -28,7 +28,7 @@ getConfig = function getConfig(name) { name: 'author', route: '/' + config.routeKeywords.author + '/:slug/', postOptions: { - filter: 'author:%s' + filter: 'author:\'%s\'' }, data: { author: { diff --git a/core/test/unit/rss_spec.js b/core/test/unit/rss_spec.js index 8503be45c4..d64edff774 100644 --- a/core/test/unit/rss_spec.js +++ b/core/test/unit/rss_spec.js @@ -304,7 +304,7 @@ describe('RSS', function () { // test res.send = function send(xmlData) { apiBrowseStub.calledOnce.should.be.true; - apiBrowseStub.calledWith({page: 1, filter: 'tags:magic', include: 'author,tags,fields'}).should.be.true; + apiBrowseStub.calledWith({page: 1, filter: 'tags:\'magic\'', include: 'author,tags,fields'}).should.be.true; apiTagStub.calledOnce.should.be.true; xmlData.should.match(/<!\[CDATA\[Magic - Test\]\]><\/title>/); done(); @@ -322,7 +322,7 @@ describe('RSS', function () { // test res.send = function send(xmlData) { apiBrowseStub.calledOnce.should.be.true; - apiBrowseStub.calledWith({page: 1, filter: 'author:joe', include: 'author,tags,fields'}).should.be.true; + apiBrowseStub.calledWith({page: 1, filter: 'author:\'joe\'', include: 'author,tags,fields'}).should.be.true; apiUserStub.calledOnce.should.be.true; xmlData.should.match(/<channel><title><!\[CDATA\[Joe Blogs - Test\]\]><\/title>/); done();