mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-22 16:58:28 +02: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));
|
].some((textType) => normalized === textType || normalized.endsWith(textType));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMimeTypeFromContentType(contentType: string) {
|
export function getMimeTypeFromContentType(contentType: string): MimeType {
|
||||||
const mimeType = new MimeType(contentType);
|
try {
|
||||||
return mimeType;
|
return new MimeType(contentType);
|
||||||
|
} catch {
|
||||||
|
return new MimeType('text/plain');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user