Fix bug
This commit is contained in:
parent
6e34e77372
commit
04cdb04ee2
|
@ -12,7 +12,7 @@ export default async function(actor: IRemoteUser, image): Promise<IDriveFile> {
|
||||||
throw new Error('invalid image');
|
throw new Error('invalid image');
|
||||||
}
|
}
|
||||||
|
|
||||||
log(`Creating the Image: ${image.id}`);
|
log(`Creating the Image: ${image.url}`);
|
||||||
|
|
||||||
return await uploadFromUrl(image.url, actor);
|
return await uploadFromUrl(image.url, actor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,15 +37,13 @@ export default async function createNote(resolver: Resolver, actor: IRemoteUser,
|
||||||
//#endergion
|
//#endergion
|
||||||
|
|
||||||
//#region 添付メディア
|
//#region 添付メディア
|
||||||
const media = [];
|
let media = [];
|
||||||
if ('attachment' in note && note.attachment != null) {
|
if ('attachment' in note && note.attachment != null) {
|
||||||
// TODO: attachmentは必ずしもImageではない
|
// TODO: attachmentは必ずしもImageではない
|
||||||
// TODO: attachmentは必ずしも配列ではない
|
// TODO: attachmentは必ずしも配列ではない
|
||||||
// TODO: ループの中でawaitはすべきでない
|
media = await Promise.all(note.attachment.map(x => {
|
||||||
note.attachment.forEach(async media => {
|
return createImage(actor, x);
|
||||||
const created = await createImage(note.actor, media);
|
}));
|
||||||
media.push(created);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,6 @@ import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file from a URL
|
* Create a file from a URL
|
||||||
*
|
|
||||||
* @param {any} params
|
|
||||||
* @param {any} user
|
|
||||||
* @return {Promise<any>}
|
|
||||||
*/
|
*/
|
||||||
module.exports = async (params, user): Promise<any> => {
|
module.exports = async (params, user): Promise<any> => {
|
||||||
// Get 'url' parameter
|
// Get 'url' parameter
|
||||||
|
|
Loading…
Reference in a new issue