mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +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;
|
||||
return Promise.all(files.map(function (image) {
|
||||
return self.storage.getUniqueFileName(image, image.targetDir).then(function (targetFilename) {
|
||||
image.newPath = self.urlUtils.urlJoin('/', self.urlUtils.getSubdir(), self.storage.staticFileURLPrefix,
|
||||
path.relative(self.config.getContentPath('media'), targetFilename));
|
||||
return Promise.all(files.map(function (contentFile) {
|
||||
return self.storage.getUniqueFileName(contentFile, contentFile.targetDir).then(function (targetFilename) {
|
||||
contentFile.newPath = self.urlUtils.urlJoin(
|
||||
'/',
|
||||
self.urlUtils.getSubdir(),
|
||||
self.storage.staticFileURLPrefix,
|
||||
path.relative(mediaContentPath, targetFilename)
|
||||
);
|
||||
|
||||
return image;
|
||||
return contentFile;
|
||||
});
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user