Commit 35c7c653 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

allow image/webp in UploadController

parent 522fb41d
...@@ -10,9 +10,12 @@ const Map<List<int>, String> supportedTypes = <List<int>, String>{ ...@@ -10,9 +10,12 @@ const Map<List<int>, String> supportedTypes = <List<int>, String>{
[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]: 'image/png', [0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]: 'image/png',
[0x47, 0x49, 0x46, 0x38]: 'image/gif', [0x47, 0x49, 0x46, 0x38]: 'image/gif',
[0x42, 0x4D]: 'image/bmp', [0x42, 0x4D]: 'image/bmp',
[0x52, 0x49, 0x46, 0x46]: 'image/webp',
}; };
class UploadController extends ResourceController { class UploadController extends ResourceController {
MimeTypeResolver mimeChecker;
UploadController() { UploadController() {
mimeChecker = MimeTypeResolver(); mimeChecker = MimeTypeResolver();
supportedTypes.forEach(mimeChecker.addMagicNumber); supportedTypes.forEach(mimeChecker.addMagicNumber);
...@@ -21,8 +24,6 @@ class UploadController extends ResourceController { ...@@ -21,8 +24,6 @@ class UploadController extends ResourceController {
.toList(); .toList();
} }
MimeTypeResolver mimeChecker;
@Scope(['user']) @Scope(['user'])
@Operation.get() @Operation.get()
Future<Response> getFiles() async { Future<Response> getFiles() async {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment