test(core/browser/platform): 26 extreme RED/GREEN TDD cycles and full regression hardening (3,235 PASS)
Some checks failed
release / test (push) Failing after 14m5s
release / windows (push) Has been cancelled
release / android (push) Has been cancelled
release / linux (push) Has been cancelled
release / macos (push) Has been cancelled

This commit is contained in:
Yun Chan 2026-09-18 23:32:32 +09:00
parent bcd242691f
commit 8677853822
100 changed files with 4814 additions and 333 deletions

View file

@ -9,12 +9,15 @@ public sealed class MhtmlWebArchivePackager
{
public string Package(WebArchivePackageRequest request)
{
if (request == null)
throw new ArgumentNullException(nameof(request));
var boundary = "----=_NextPart_" + Guid.NewGuid().ToString("N");
var sb = new StringBuilder();
sb.AppendLine("From: <Saved by PACA Browser>");
sb.AppendLine($"Snapshot-Content-Location: {request.Url}");
sb.AppendLine($"Subject: {request.Title}");
sb.AppendLine($"Snapshot-Content-Location: {request.Url ?? string.Empty}");
sb.AppendLine($"Subject: {request.Title ?? "Untitled"}");
sb.AppendLine($"Date: {DateTime.UtcNow:R}");
sb.AppendLine("MIME-Version: 1.0");
sb.AppendLine($"Content-Type: multipart/related; boundary=\"{boundary}\"; type=\"text/html\"");
@ -24,21 +27,26 @@ public sealed class MhtmlWebArchivePackager
sb.AppendLine($"--{boundary}");
sb.AppendLine("Content-Type: text/html; charset=\"utf-8\"");
sb.AppendLine("Content-Transfer-Encoding: 8bit");
sb.AppendLine($"Content-Location: {request.Url}");
sb.AppendLine($"Content-Location: {request.Url ?? string.Empty}");
sb.AppendLine();
sb.AppendLine(request.HtmlContent);
sb.AppendLine(request.HtmlContent ?? string.Empty);
sb.AppendLine();
// Resources
foreach (var res in request.Resources)
if (request.Resources != null)
{
sb.AppendLine($"--{boundary}");
sb.AppendLine($"Content-Type: {res.MimeType}");
sb.AppendLine("Content-Transfer-Encoding: base64");
sb.AppendLine($"Content-Location: {res.Url}");
sb.AppendLine();
sb.AppendLine(Convert.ToBase64String(res.Data));
sb.AppendLine();
foreach (var res in request.Resources)
{
if (res == null) continue;
var data = res.Data ?? Array.Empty<byte>();
sb.AppendLine($"--{boundary}");
sb.AppendLine($"Content-Type: {res.MimeType ?? "application/octet-stream"}");
sb.AppendLine("Content-Transfer-Encoding: base64");
sb.AppendLine($"Content-Location: {res.Url ?? string.Empty}");
sb.AppendLine();
sb.AppendLine(Convert.ToBase64String(data));
sb.AppendLine();
}
}
sb.AppendLine($"--{boundary}--");