| ... | ... | @@ -962,23 +962,27 @@ fn unpackResource( |
| 962 | 962 | const content_type = req.response.headers.getFirstValue("Content-Type") orelse |
| 963 | 963 | return f.fail(f.location_tok, try eb.addString("missing 'Content-Type' header")); |
| 964 | 964 | |
| 965 | | if (ascii.eqlIgnoreCase(content_type, "application/x-tar")) |
| 965 | // Extract the MIME type, ignoring charset and boundary directives |
| 966 | const mime_type_end = std.mem.indexOf(u8, content_type, ";") orelse content_type.len; |
| 967 | const mime_type = content_type[0..mime_type_end]; |
| 968 | |
| 969 | if (ascii.eqlIgnoreCase(mime_type, "application/x-tar")) |
| 966 | 970 | break :ft .tar; |
| 967 | 971 | |
| 968 | | if (ascii.eqlIgnoreCase(content_type, "application/gzip") or |
| 969 | | ascii.eqlIgnoreCase(content_type, "application/x-gzip") or |
| 970 | | ascii.eqlIgnoreCase(content_type, "application/tar+gzip")) |
| 972 | if (ascii.eqlIgnoreCase(mime_type, "application/gzip") or |
| 973 | ascii.eqlIgnoreCase(mime_type, "application/x-gzip") or |
| 974 | ascii.eqlIgnoreCase(mime_type, "application/tar+gzip")) |
| 971 | 975 | { |
| 972 | 976 | break :ft .@"tar.gz"; |
| 973 | 977 | } |
| 974 | 978 | |
| 975 | | if (ascii.eqlIgnoreCase(content_type, "application/x-xz")) |
| 979 | if (ascii.eqlIgnoreCase(mime_type, "application/x-xz")) |
| 976 | 980 | break :ft .@"tar.xz"; |
| 977 | 981 | |
| 978 | | if (ascii.eqlIgnoreCase(content_type, "application/zstd")) |
| 982 | if (ascii.eqlIgnoreCase(mime_type, "application/zstd")) |
| 979 | 983 | break :ft .@"tar.zst"; |
| 980 | 984 | |
| 981 | | if (!ascii.eqlIgnoreCase(content_type, "application/octet-stream")) { |
| 985 | if (!ascii.eqlIgnoreCase(mime_type, "application/octet-stream")) { |
| 982 | 986 | return f.fail(f.location_tok, try eb.printString( |
| 983 | 987 | "unrecognized 'Content-Type' header: '{s}'", |
| 984 | 988 | .{content_type}, |