diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-05-24 13:59:26 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-05-24 13:59:26 +0900 |
| commit | 64791a716088c30cf94c3334b203162ab03401fd (patch) | |
| tree | 72d0fca163786dc46b5e5f16f44f0b3ac38aefdc /packages/frontend/src/utility/drive.ts | |
| parent | fix(backend): unallowedFileTypeエラーがハンドリングされていな... (diff) | |
| download | misskey-64791a716088c30cf94c3334b203162ab03401fd.tar.gz misskey-64791a716088c30cf94c3334b203162ab03401fd.tar.bz2 misskey-64791a716088c30cf94c3334b203162ab03401fd.zip | |
fix(frontend): ユーザに表示されるファイル種別と、実際のファイル種別が異なり、ファイルをアップロードすることに失敗することがある問題を修正
Fix #16091
Diffstat (limited to 'packages/frontend/src/utility/drive.ts')
| -rw-r--r-- | packages/frontend/src/utility/drive.ts | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/packages/frontend/src/utility/drive.ts b/packages/frontend/src/utility/drive.ts index de473c9b11..f171a4d14d 100644 --- a/packages/frontend/src/utility/drive.ts +++ b/packages/frontend/src/utility/drive.ts @@ -39,20 +39,22 @@ export function uploadFile(file: File | Blob, options: { const filePromise = new Promise<Misskey.entities.DriveFile>((resolve, reject) => { if ($i == null) return reject(); - const allowedMimeTypes = $i.policies.uploadableFileTypes; - const isAllowedMimeType = allowedMimeTypes.some(mimeType => { - if (mimeType === '*' || mimeType === '*/*') return true; - if (mimeType.endsWith('/*')) return file.type.startsWith(mimeType.slice(0, -1)); - return file.type === mimeType; - }); - if (!isAllowedMimeType) { - os.alert({ - type: 'error', - title: i18n.ts.failedToUpload, - text: i18n.ts.cannotUploadBecauseUnallowedFileType, - }); - return reject(); - } + // こっち側で検出するMIME typeとサーバーで検出するMIME typeは異なる場合があるため、こっち側ではやらないことにする + // https://github.com/misskey-dev/misskey/issues/16091 + //const allowedMimeTypes = $i.policies.uploadableFileTypes; + //const isAllowedMimeType = allowedMimeTypes.some(mimeType => { + // if (mimeType === '*' || mimeType === '*/*') return true; + // if (mimeType.endsWith('/*')) return file.type.startsWith(mimeType.slice(0, -1)); + // return file.type === mimeType; + //}); + //if (!isAllowedMimeType) { + // os.alert({ + // type: 'error', + // title: i18n.ts.failedToUpload, + // text: i18n.ts.cannotUploadBecauseUnallowedFileType, + // }); + // return reject(); + //} if ((file.size > instance.maxFileSize) || (file.size > ($i.policies.maxFileSizeMb * 1024 * 1024))) { os.alert({ |