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

Fixed tests for post input serialization

refs #10472

- Moved config related variable into function scope, so it can be reset by unit tests
- e47d1e275f broke the build and is being fixed by this commit
This commit is contained in:
Nazar Gargol 2019-02-12 12:04:18 +00:00
parent 7a6375f931
commit d0d299285c

View file

@ -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));