mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Refactored media file import path calculation
refs https://github.com/TryGhost/Toolbox/issues/523 - The naming was referring to "image", which is a leftover from a copy-paste. - It's much nicer to read a skimmable, columnar urlJoin method parameters instead of one long line
This commit is contained in:
parent
2361669bb6
commit
0c111cfe6b
@ -51,12 +51,16 @@ class ImporterMediaHandler {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const self = this;
|
const self = this;
|
||||||
return Promise.all(files.map(function (image) {
|
return Promise.all(files.map(function (contentFile) {
|
||||||
return self.storage.getUniqueFileName(image, image.targetDir).then(function (targetFilename) {
|
return self.storage.getUniqueFileName(contentFile, contentFile.targetDir).then(function (targetFilename) {
|
||||||
image.newPath = self.urlUtils.urlJoin('/', self.urlUtils.getSubdir(), self.storage.staticFileURLPrefix,
|
contentFile.newPath = self.urlUtils.urlJoin(
|
||||||
path.relative(self.config.getContentPath('media'), targetFilename));
|
'/',
|
||||||
|
self.urlUtils.getSubdir(),
|
||||||
|
self.storage.staticFileURLPrefix,
|
||||||
|
path.relative(mediaContentPath, targetFilename)
|
||||||
|
);
|
||||||
|
|
||||||
return image;
|
return contentFile;
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user