diff --git a/packages/console/src/consts/user-assets.ts b/packages/console/src/consts/user-assets.ts index 323421f6c..2ecbdb524 100644 --- a/packages/console/src/consts/user-assets.ts +++ b/packages/console/src/consts/user-assets.ts @@ -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'], diff --git a/packages/console/src/hooks/use-image-mime-types.ts b/packages/console/src/hooks/use-image-mime-types.ts index bcc74f756..7300516a4 100644 --- a/packages/console/src/hooks/use-image-mime-types.ts +++ b/packages/console/src/hooks/use-image-mime-types.ts @@ -11,6 +11,7 @@ const allowedImageMimeTypes: AllowedUploadMimeType[] = [ 'image/png', 'image/jpeg', 'image/vnd.microsoft.icon', + 'image/x-icon', ]; const useImageMimeTypes = ( diff --git a/packages/console/src/utils/uploader.ts b/packages/console/src/utils/uploader.ts index 248ed7345..c4cb161e4 100644 --- a/packages/console/src/utils/uploader.ts +++ b/packages/console/src/utils/uploader.ts @@ -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()) + ); diff --git a/packages/schemas/src/types/user-assets.ts b/packages/schemas/src/types/user-assets.ts index 7244491ad..d6e2d4312 100644 --- a/packages/schemas/src/types/user-assets.ts +++ b/packages/schemas/src/types/user-assets.ts @@ -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',