Netlify Large Media integration (#2124)
This commit is contained in:
committed by
Shawn Erquhart
parent
17ae6f3045
commit
da2249c651
@ -223,17 +223,18 @@ export default class Bitbucket {
|
||||
|
||||
return this.api.listAllFiles(this.config.get('media_folder')).then(files =>
|
||||
files.map(({ id, name, path }) => {
|
||||
const getBlobPromise = () =>
|
||||
const getDisplayURL = () =>
|
||||
new Promise((resolve, reject) =>
|
||||
sem.take(() =>
|
||||
this.api
|
||||
.readFile(path, id, { parseText: false })
|
||||
.then(blob => URL.createObjectURL(blob))
|
||||
.then(resolve, reject)
|
||||
.finally(() => sem.leave()),
|
||||
),
|
||||
);
|
||||
|
||||
return { id, name, getBlobPromise, path };
|
||||
return { id, name, getDisplayURL, path };
|
||||
}),
|
||||
);
|
||||
}
|
||||
@ -245,8 +246,7 @@ export default class Bitbucket {
|
||||
async persistMedia(mediaFile, options = {}) {
|
||||
await this.api.persistFiles([mediaFile], options);
|
||||
const { value, path, fileObj } = mediaFile;
|
||||
const getBlobPromise = () => Promise.resolve(fileObj);
|
||||
return { name: value, size: fileObj.size, getBlobPromise, path: trimStart(path, '/k') };
|
||||
return { name: value, size: fileObj.size, path: trimStart(path, '/k') };
|
||||
}
|
||||
|
||||
deleteFile(path, commitMessage, options) {
|
||||
|
Reference in New Issue
Block a user