From d0d299285c5aba25a24830c42b32cda14f956143 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Tue, 12 Feb 2019 12:04:18 +0000 Subject: [PATCH] Fixed tests for post input serialization refs #10472 - Moved config related variable into function scope, so it can be reset by unit tests - e47d1e275ffaf88d83abce199ac8d1efa729a001 broke the build and is being fixed by this commit --- core/server/api/v2/utils/serializers/input/utils/url.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/server/api/v2/utils/serializers/input/utils/url.js b/core/server/api/v2/utils/serializers/input/utils/url.js index 63f3c74b07..df5820f454 100644 --- a/core/server/api/v2/utils/serializers/input/utils/url.js +++ b/core/server/api/v2/utils/serializers/input/utils/url.js @@ -1,9 +1,8 @@ const _ = require('lodash'); const {absoluteToRelative, getBlogUrl, STATIC_IMAGE_URL_PREFIX} = require('../../../../../../services/url/utils'); -const blogDomain = getBlogUrl().replace(/^http(s?):\/\//, '').replace(/\/$/, ''); - const handleImageUrl = (imageUrl) => { + const blogDomain = getBlogUrl().replace(/^http(s?):\/\//, '').replace(/\/$/, ''); const imageUrlAbsolute = imageUrl.replace(/^http(s?):\/\//, ''); const imagePathRe = new RegExp(`^${blogDomain}/${STATIC_IMAGE_URL_PREFIX}`); if (imagePathRe.test(imageUrlAbsolute)) { @@ -13,6 +12,7 @@ const handleImageUrl = (imageUrl) => { }; const handleContentUrls = (content) => { + const blogDomain = getBlogUrl().replace(/^http(s?):\/\//, '').replace(/\/$/, ''); const imagePathRe = new RegExp(`(http(s?)://)?${blogDomain}/${STATIC_IMAGE_URL_PREFIX}`, 'g'); const matches = _.uniq(content.match(imagePathRe));