Browse Source

feat(nc-gui): allow all mime types logic

pull/4931/head
Wing-Kam Wong 2 years ago
parent
commit
c6039e3536
  1. 3
      packages/nc-gui/components/cell/attachment/utils.ts
  2. 4
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts

3
packages/nc-gui/components/cell/attachment/utils.ts

@ -66,7 +66,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
maxNumberOfAttachments: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 50) || 50,
// Maximum File Size per file
maxAttachmentSize: Math.max(1, +appInfo.value.ncMaxAttachmentsAllowed || 20) || 20,
supportedAttachmentMimeTypes: ['application', 'audio', 'image', 'video', 'misc'],
supportedAttachmentMimeTypes: ['*'],
}),
}
@ -125,6 +125,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
// verify mime type
if (
!attachmentMeta.supportedAttachmentMimeTypes.includes('*') &&
!attachmentMeta.supportedAttachmentMimeTypes.includes(file.type) &&
!attachmentMeta.supportedAttachmentMimeTypes.includes(file.type.split('/')[0])
) {

4
packages/nc-gui/composables/useMultiSelect/convertCellData.ts

@ -81,13 +81,14 @@ export default function convertCellData(
if (parsedVal.some((v: any) => v && !(v.url || v.data))) {
throw new Error('Invalid attachment data')
}
// TODO(refactor): duplicate logic in attachment/utils.ts
const defaultAttachmentMeta = {
...(args.appInfo.ee && {
// Maximum Number of Attachments per cell
maxNumberOfAttachments: Math.max(1, +args.appInfo.ncMaxAttachmentsAllowed || 50) || 50,
// Maximum File Size per file
maxAttachmentSize: Math.max(1, +args.appInfo.ncMaxAttachmentsAllowed || 20) || 20,
supportedAttachmentMimeTypes: ['application', 'audio', 'image', 'video', 'misc'],
supportedAttachmentMimeTypes: ['*'],
}),
}
@ -118,6 +119,7 @@ export default function convertCellData(
// verify mime type
if (
!attachmentMeta.supportedAttachmentMimeTypes.includes('*') &&
!attachmentMeta.supportedAttachmentMimeTypes.includes(attachment.type) &&
!attachmentMeta.supportedAttachmentMimeTypes.includes(attachment.type.split('/')[0])
) {

Loading…
Cancel
Save