From 2fc7204bd5ecd842d6acfe41715419c15e732a25 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Tue, 28 Jul 2026 01:22:31 +0000 Subject: [PATCH] Make HTTP artifact MIME test deterministic --- internal/adapter/http/artifact_reader_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/adapter/http/artifact_reader_test.go b/internal/adapter/http/artifact_reader_test.go index 8ab653b..9145a41 100644 --- a/internal/adapter/http/artifact_reader_test.go +++ b/internal/adapter/http/artifact_reader_test.go @@ -3,7 +3,6 @@ package httpadapter import ( "context" "errors" - "mime" "os" "path/filepath" "testing" @@ -14,7 +13,7 @@ import ( func TestRestrictedArtifactReaderReadsContainedFiles(t *testing.T) { root := t.TempDir() outside := t.TempDir() - inputPath := filepath.Join(root, "input.md") + inputPath := filepath.Join(root, "input.html") if err := os.WriteFile(inputPath, []byte("allowed"), 0o644); err != nil { t.Fatal(err) } @@ -34,17 +33,17 @@ func TestRestrictedArtifactReaderReadsContainedFiles(t *testing.T) { } for _, ref := range []scriptorium.ArtifactRef{ - {Type: scriptorium.ArtifactRefFile, URI: "nested/../input.md"}, + {Type: scriptorium.ArtifactRefFile, URI: "nested/../input.html"}, {Type: scriptorium.ArtifactRefFile, URI: inputPath}, } { artifact, err := reader.Read(context.Background(), ref) if err != nil { t.Fatalf("read contained path %q: %v", ref.URI, err) } - if artifact.Name != "input.md" || artifact.URI != inputPath || artifact.Size != int64(len("allowed")) || string(artifact.Body) != "allowed" { + if artifact.Name != "input.html" || artifact.URI != inputPath || artifact.Size != int64(len("allowed")) || string(artifact.Body) != "allowed" { t.Fatalf("unexpected artifact metadata: %#v", artifact) } - if artifact.ContentType != mime.TypeByExtension(".md") { + if artifact.ContentType != "text/html; charset=utf-8" { t.Fatalf("unexpected artifact content type: %q", artifact.ContentType) } if artifact.Hash != artifactHash([]byte("allowed")) {