diff --git a/core/frontend/apps/amp/lib/helpers/amp_content.js b/core/frontend/apps/amp/lib/helpers/amp_content.js index 62f33ec862..d04dc80be5 100644 --- a/core/frontend/apps/amp/lib/helpers/amp_content.js +++ b/core/frontend/apps/amp/lib/helpers/amp_content.js @@ -124,7 +124,7 @@ function getAmperizeHTML(html, post) { amperize = amperize || new Amperize(); // make relative URLs abolute - html = urlUtils.htmlRelativeToAbsolute(html, urlUtils.urlFor('home', true), post.url).html(); + html = urlUtils.htmlRelativeToAbsolute(html, urlUtils.urlFor('home', true), post.url); if (!amperizeCache[post.id] || moment(new Date(amperizeCache[post.id].updated_at)).diff(new Date(post.updated_at)) < 0) { return new Promise((resolve) => { diff --git a/core/frontend/services/rss/generate-feed.js b/core/frontend/services/rss/generate-feed.js index aabfca5e50..ded064996e 100644 --- a/core/frontend/services/rss/generate-feed.js +++ b/core/frontend/services/rss/generate-feed.js @@ -1,5 +1,6 @@ var downsize = require('downsize'), Promise = require('bluebird'), + cheerio = require('cheerio'), RSS = require('rss'), urlUtils = require('../../../server/lib/url-utils'), urlService = require('../url'), @@ -22,7 +23,7 @@ generateTags = function generateTags(data) { generateItem = function generateItem(post, siteUrl, secure) { var itemUrl = urlService.getUrlByResourceId(post.id, {secure: secure, absolute: true}), - htmlContent = urlUtils.htmlRelativeToAbsolute(post.html, siteUrl, itemUrl), + htmlContent = cheerio.load(urlUtils.htmlRelativeToAbsolute(post.html, siteUrl, itemUrl), {decodeEntities: false}), item = { title: post.title, // @TODO: DRY this up with data/meta/index & other excerpt code diff --git a/core/server/api/canary/utils/serializers/output/utils/url.js b/core/server/api/canary/utils/serializers/output/utils/url.js index bd41df7521..ef9b7f71b7 100644 --- a/core/server/api/canary/utils/serializers/output/utils/url.js +++ b/core/server/api/canary/utils/serializers/output/utils/url.js @@ -60,7 +60,7 @@ const forPost = (id, attrs, frame) => { urlUtils.urlFor('home', true), attrs.url, urlOptions - ).html(); + ); } if (frame.options.columns && !frame.options.columns.includes('url')) { diff --git a/core/server/api/v0.1/decorators/urls.js b/core/server/api/v0.1/decorators/urls.js index 12cd589c25..c186f84d41 100644 --- a/core/server/api/v0.1/decorators/urls.js +++ b/core/server/api/v0.1/decorators/urls.js @@ -22,7 +22,7 @@ const urlsForPost = (id, attrs, options) => { } if (attrs.html) { - attrs.html = urlUtils.htmlRelativeToAbsolute(attrs.html, urlUtils.urlFor('home', true), attrs.url).html(); + attrs.html = urlUtils.htmlRelativeToAbsolute(attrs.html, urlUtils.urlFor('home', true), attrs.url); } if (attrs.url) { diff --git a/core/server/api/v2/utils/serializers/output/utils/url.js b/core/server/api/v2/utils/serializers/output/utils/url.js index abfb15670f..9e7d9f7b41 100644 --- a/core/server/api/v2/utils/serializers/output/utils/url.js +++ b/core/server/api/v2/utils/serializers/output/utils/url.js @@ -60,7 +60,7 @@ const forPost = (id, attrs, frame) => { urlUtils.urlFor('home', true), attrs.url, urlOptions - ).html(); + ); } if (frame.options.columns && !frame.options.columns.includes('url')) { diff --git a/package.json b/package.json index b0bf8713ae..e4a3635549 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@tryghost/members-theme-bindings": "0.2.3", "@tryghost/social-urls": "0.1.1", "@tryghost/string": "^0.1.3", - "@tryghost/url-utils": "0.2.0", + "@tryghost/url-utils": "0.3.0", "ajv": "6.10.2", "amperize": "0.6.0", "analytics-node": "3.3.0", diff --git a/yarn.lock b/yarn.lock index 8a27e6b4a8..eb84565c69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -267,10 +267,10 @@ dependencies: unidecode "^0.1.8" -"@tryghost/url-utils@0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@tryghost/url-utils/-/url-utils-0.2.0.tgz#d32b23122ea78b23a63c6ab25d160cbf4f65e53e" - integrity sha512-/Ex9z8RUAfAek8z7EMvnDBIV5P88jwL1X4KwXxZy5udn0aQShvSwsO5euOpUcjBOn2ZsUT3aXYsB+pz7uXm8hw== +"@tryghost/url-utils@0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@tryghost/url-utils/-/url-utils-0.3.0.tgz#59f101945f56b0e53d8b8ad394c47538beb33d0b" + integrity sha512-a0MKw054P6VRAbqqx2C61Tj2RskRouBMt31+tVFCT+Lyy+FxaQD18I/n+pwlnNd6Z5BF+Bi2etSnS3ldRsOfQg== dependencies: cheerio "0.22.0" lodash "4.17.11"