mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-08 05:45:10 +02:00
Handle quotes around charset
This commit is contained in:
@@ -58,5 +58,7 @@ export function getContentTypeHeader(headers: HttpResponseHeader[]): string | nu
|
|||||||
|
|
||||||
export function getCharsetFromContentType(headers: HttpResponseHeader[]): string | null {
|
export function getCharsetFromContentType(headers: HttpResponseHeader[]): string | null {
|
||||||
const contentType = getContentTypeHeader(headers);
|
const contentType = getContentTypeHeader(headers);
|
||||||
return contentType?.match(/charset=([^ ;]+)/)?.[1] ?? null;
|
if (contentType == null) return null;
|
||||||
|
|
||||||
|
return contentType.toLowerCase().match(/charset="?([^ ;"]+)"?/)?.[1] || null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user