0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Cleaned up use of 'content/media' magic string

refs https://linear.app/tryghost/issue/CORE-121/create-a-video-storage-adapter

- `content/media` path is now a part of the constants package and should've been used instead of a magic-string.
This commit is contained in:
Naz 2021-10-28 17:37:31 +04:00 committed by naz
parent d20732ce34
commit d657432531

View file

@ -1,9 +1,9 @@
const config = require('../../../../../../shared/config');
const STATIC_VIDEO_URL_PREFIX = require('@tryghost/constants');
function getURL(urlPath) {
const STATIC_VIDEO_URL_PREFIX = 'content/media';
const imagePathRe = new RegExp('^' + config.getSubdir() + '/' + STATIC_VIDEO_URL_PREFIX);
const absolute = imagePathRe.test(urlPath) ? true : false;
const media = new RegExp('^' + config.getSubdir() + '/' + STATIC_VIDEO_URL_PREFIX);
const absolute = media.test(urlPath) ? true : false;
if (absolute) {
// Remove the sub-directory from the URL because ghostConfig will add it back.