Update docs
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { fileType, formatSize, isUploadableType } from '../src/shared/upload'
|
||||
import { fileType, formatSize, isUploadableName, isUploadableType } from '../src/shared/upload'
|
||||
import { declaredLength, uploadTimestamp } from '../src/receive'
|
||||
|
||||
describe('isUploadableType', () => {
|
||||
@@ -22,6 +22,20 @@ describe('isUploadableType', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('isUploadableName', () => {
|
||||
it('refuses an SVG extension whatever type the request declares', () => {
|
||||
expect(isUploadableName('evil.svg')).toBe(false)
|
||||
expect(isUploadableName('ipp_upload_evil.SVG')).toBe(false)
|
||||
expect(isUploadableName('evil.svgz')).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts photo and video extensions, and leaves the finer check to Immich', () => {
|
||||
expect(isUploadableName('IMG_0042.jpg')).toBe(true)
|
||||
expect(isUploadableName('clip.mp4')).toBe(true)
|
||||
expect(isUploadableName('my.svg.jpg')).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
describe('fileType', () => {
|
||||
it('keeps the type the browser gave', () => {
|
||||
expect(fileType('IMG_0042.HEIC', 'image/heic')).toBe('image/heic')
|
||||
|
||||
Reference in New Issue
Block a user