mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +00:00
UBERF-8530 Fix empty image/video upload (#7030)
Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
parent
7eec2b55eb
commit
2390b0d761
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { type Blob, type Ref } from '@hcengineering/core'
|
||||
import { getResource } from '@hcengineering/platform'
|
||||
import { type PopupAlignment } from '@hcengineering/ui'
|
||||
@ -36,7 +37,13 @@ export async function getFileMetadata (file: FileOrBlob, uuid: Ref<Blob>): Promi
|
||||
return undefined
|
||||
}
|
||||
|
||||
return await metadataProvider(file, uuid)
|
||||
try {
|
||||
return await metadataProvider(file, uuid)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
Analytics.handleError(err as Error)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,6 +17,10 @@ import { type Blob, type Ref } from '@hcengineering/core'
|
||||
import { type BlobMetadata, getImageSize } from '@hcengineering/presentation'
|
||||
|
||||
export async function blobImageMetadata (file: File, blob: Ref<Blob>): Promise<BlobMetadata | undefined> {
|
||||
if (file.size === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const size = await getImageSize(file)
|
||||
|
||||
return {
|
||||
@ -27,6 +31,10 @@ export async function blobImageMetadata (file: File, blob: Ref<Blob>): Promise<B
|
||||
}
|
||||
|
||||
export async function blobVideoMetadata (file: File, blob: Ref<Blob>): Promise<BlobMetadata | undefined> {
|
||||
if (file.size === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const size = await getVideoSize(file)
|
||||
|
||||
if (size === undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user