mirror of
https://iceshrimp.dev/iceshrimp/iceshrimp
synced 2024-11-28 14:58:09 +09:00
Resolve #2560
This commit is contained in:
parent
7a2b1c43f7
commit
d4f4a557f4
@ -132,25 +132,14 @@ export default (params: any, user: ILocalUser, app: IApp) => new Promise(async (
|
|||||||
let files: IDriveFile[] = [];
|
let files: IDriveFile[] = [];
|
||||||
const fileIds = ps.fileIds != null ? ps.fileIds : ps.mediaIds != null ? ps.mediaIds : null;
|
const fileIds = ps.fileIds != null ? ps.fileIds : ps.mediaIds != null ? ps.mediaIds : null;
|
||||||
if (fileIds != null) {
|
if (fileIds != null) {
|
||||||
// Fetch files
|
files = await Promise.all(fileIds.map(fileId => {
|
||||||
// forEach だと途中でエラーなどがあっても return できないので
|
return DriveFile.findOne({
|
||||||
// 敢えて for を使っています。
|
|
||||||
for (const fileId of fileIds) {
|
|
||||||
// Fetch file
|
|
||||||
// SELECT _id
|
|
||||||
const entity = await DriveFile.findOne({
|
|
||||||
_id: fileId,
|
_id: fileId,
|
||||||
'metadata.userId': user._id
|
'metadata.userId': user._id
|
||||||
});
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
if (entity === null) {
|
files = files.filter(file => file != null);
|
||||||
return rej('file not found');
|
|
||||||
} else {
|
|
||||||
files.push(entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
files = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let renote: INote = null;
|
let renote: INote = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user