mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 06:12:03 +03:00
07afb08875
refs https://linear.app/tryghost/issue/CORE-1/multiple-adapters-per-type - Having this preemptive change allows to separate implementation of "image" storage from future usecases like "videos", "audios" etc. Even if the "image" adapter is not configured the default behavior will fallback to use the "active" storage adapter. If there's a need to handle "images" differently through a custom apapter that'll work out of the box ;)
21 lines
526 B
JavaScript
21 lines
526 B
JavaScript
const Promise = require('bluebird');
|
|
const storage = require('../../adapters/storage');
|
|
|
|
module.exports = {
|
|
docName: 'images',
|
|
upload: {
|
|
statusCode: 201,
|
|
permissions: false,
|
|
query(frame) {
|
|
const store = storage.getStorage('images');
|
|
|
|
if (frame.files) {
|
|
return Promise
|
|
.map(frame.files, file => store.save(file))
|
|
.then(paths => paths[0]);
|
|
}
|
|
return store.save(frame.file);
|
|
}
|
|
}
|
|
};
|