mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-12 02:26:30 -05:00
Fix content type parsing exception
This commit is contained in:
@@ -75,7 +75,10 @@ export function isProbablyTextContentType(contentType: string | null): boolean {
|
||||
].some((textType) => normalized === textType || normalized.endsWith(textType));
|
||||
}
|
||||
|
||||
export function getMimeTypeFromContentType(contentType: string) {
|
||||
const mimeType = new MimeType(contentType);
|
||||
return mimeType;
|
||||
export function getMimeTypeFromContentType(contentType: string): MimeType {
|
||||
try {
|
||||
return new MimeType(contentType);
|
||||
} catch {
|
||||
return new MimeType('text/plain');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user