mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	Add avif image file support (#32508)
Most modern browsers support it now ` Update ALLOWED_TYPES #96 ` https://gitea.com/gitea/docs/pulls/96 --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
		| @@ -118,7 +118,7 @@ test('encodeURLEncodedBase64, decodeURLEncodedBase64', () => { | ||||
| }); | ||||
|  | ||||
| test('file detection', () => { | ||||
|   for (const name of ['a.jpg', '/a.jpeg', '.file.png', '.webp', 'file.svg']) { | ||||
|   for (const name of ['a.avif', 'a.jpg', '/a.jpeg', '.file.png', '.webp', 'file.svg']) { | ||||
|     expect(isImageFile({name})).toBeTruthy(); | ||||
|   } | ||||
|   for (const name of ['', 'a.jpg.x', '/path.png/x', 'webp']) { | ||||
|   | ||||
| @@ -165,7 +165,7 @@ export function sleep(ms: number): Promise<void> { | ||||
| } | ||||
|  | ||||
| export function isImageFile({name, type}: {name: string, type?: string}): boolean { | ||||
|   return /\.(jpe?g|png|gif|webp|svg|heic)$/i.test(name || '') || type?.startsWith('image/'); | ||||
|   return /\.(avif|jpe?g|png|gif|webp|svg|heic)$/i.test(name || '') || type?.startsWith('image/'); | ||||
| } | ||||
|  | ||||
| export function isVideoFile({name, type}: {name: string, type?: string}): boolean { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 wxiaoguang
					wxiaoguang