fix: uploadFile when folder is undefined

In uploadFile, folder can be undefined when uploading to the parent
folder.
This commit is contained in:
Norm 2022-08-11 17:59:17 -04:00 committed by Gitea
parent 2209490cc8
commit 7abad139f8

View file

@ -29,11 +29,11 @@ const mimeTypeMap = {
export function uploadFile(
file: File,
folder?: any,
folder?: string | Record<string, any>,
name?: string,
keepOriginal: boolean = defaultStore.state.keepOriginalUploading,
): Promise<Misskey.entities.DriveFile> {
const folderId = typeof folder === 'string' ? folder : folder.id;
const folderId = typeof folder === 'string' ? folder : folder?.id;
return new Promise((resolve, reject) => {
const id = Math.random().toString();