0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): allow image/x-icon mime type (#5193)

This commit is contained in:
Xiao Yijun 2024-01-03 11:20:21 +08:00 committed by GitHub
parent 2b273b4a6f
commit 06c5795181
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 3 deletions

View file

@ -9,6 +9,7 @@ export const mimeTypeToFileExtensionMappings: MimeTypeToFileExtensionMappings =
'image/png': ['png'],
'image/gif': ['gif'],
'image/vnd.microsoft.icon': ['ico'],
'image/x-icon': ['ico'],
'image/svg+xml': ['svg'],
'image/tiff': ['tif', 'tiff'],
'image/webp': ['webp'],

View file

@ -11,6 +11,7 @@ const allowedImageMimeTypes: AllowedUploadMimeType[] = [
'image/png',
'image/jpeg',
'image/vnd.microsoft.icon',
'image/x-icon',
];
const useImageMimeTypes = (

View file

@ -1,8 +1,11 @@
import type { AllowedUploadMimeType } from '@logto/schemas';
import { deduplicate } from '@silverhand/essentials';
import { mimeTypeToFileExtensionMappings } from '@/consts/user-assets';
export const convertToFileExtensionArray = (mimeTypes: AllowedUploadMimeType[]) =>
mimeTypes
.flatMap((type) => mimeTypeToFileExtensionMappings[type])
.map((extension) => extension.toUpperCase());
deduplicate(
mimeTypes
.flatMap((type) => mimeTypeToFileExtensionMappings[type])
.map((extension) => extension.toUpperCase())
);

View file

@ -8,6 +8,7 @@ export const allowUploadMimeTypes = [
'image/png',
'image/gif',
'image/vnd.microsoft.icon',
'image/x-icon',
'image/svg+xml',
'image/tiff',
'image/webp',