| ... | @@ -510,6 +510,16 @@ fn fetchAndUnpack( | ... | @@ -510,6 +510,16 @@ fn fetchAndUnpack( |
| 510 | // I have not checked what buffer sizes the xz decompression implementation uses | 510 | // I have not checked what buffer sizes the xz decompression implementation uses |
| 511 | // by default, so the same logic applies for buffering the reader as for gzip. | 511 | // by default, so the same logic applies for buffering the reader as for gzip. |
| 512 | try unpackTarball(gpa, &req, tmp_directory.handle, std.compress.xz); | 512 | try unpackTarball(gpa, &req, tmp_directory.handle, std.compress.xz); |
| | 513 | } else if (ascii.eqlIgnoreCase(content_type, "application/octet-stream")) { |
| | 514 | // support gitlab tarball urls such as https://gitlab.com/<namespace>/<project>/-/archive/<sha>/<project>-<sha>.tar.gz |
| | 515 | // whose content-disposition header is: 'attachment; filename="<project>-<sha>.tar.gz"' |
| | 516 | const content_disposition = req.response.headers.getFirstValue("Content-Disposition") orelse |
| | 517 | return report.fail(dep.url_tok, "Missing 'Content-Disposition' header for Content-Type=application/octet-stream", .{}); |
| | 518 | if (mem.startsWith(u8, content_disposition, "attachment;") and |
| | 519 | mem.endsWith(u8, content_disposition, ".tar.gz\"")) |
| | 520 | { |
| | 521 | try unpackTarball(gpa, &req, tmp_directory.handle, std.compress.gzip); |
| | 522 | } else return report.fail(dep.url_tok, "Unsupported 'Content-Disposition' header value: '{s}' for Content-Type=application/octet-stream", .{content_disposition}); |
| 513 | } else { | 523 | } else { |
| 514 | return report.fail(dep.url_tok, "Unsupported 'Content-Type' header value: '{s}'", .{content_type}); | 524 | return report.fail(dep.url_tok, "Unsupported 'Content-Type' header value: '{s}'", .{content_type}); |
| 515 | } | 525 | } |