Skip to content

Commit 89581ef

Browse files
authored
Added test for CDN config for Subdir site (#713)
ref https://linear.app/ghost/issue/PRO-1517 - A site of example.com/blog with a UUID of 79a967d0-dc42-4623-a0b5-dffbd4193b40 still only has files at storage.ghost.io/c/79/a9/79a967d0-dc42-4623-a0b5-dffbd4193b40/content/files/ not storage.ghost.io/c/79/a9/79a967d0-dc42-4623-a0b5-dffbd4193b40/blog/content/files/
1 parent d01338d commit 89581ef

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/url-utils/test/unit/utils/transform-ready-to-absolute.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,19 @@ describe('utils: transformReadyToAbsolute()', function () {
128128
result.should.equal('https://site-base.com/content/media/video.mp4');
129129
});
130130

131+
it('converts media url with CDN and subdirectory in site URL', function () {
132+
const storageCdn = 'https://storage.ghost.io/c/test-uuid';
133+
const subdirSiteUrl = 'https://mysite.com/blog';
134+
const options = {
135+
staticMediaUrlPrefix: 'content/media',
136+
mediaBaseUrl: storageCdn
137+
};
138+
139+
const result = transformReadyToAbsolute('__GHOST_URL__/content/media/video.mp4', subdirSiteUrl, options);
140+
141+
result.should.equal('https://storage.ghost.io/c/test-uuid/content/media/video.mp4');
142+
});
143+
131144
it('uses CDN for media and site URL for files when only media CDN is configured', function () {
132145
const options = {
133146
staticImageUrlPrefix: 'content/images',

0 commit comments

Comments
 (0)