Commit 9cf03a66 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove magic number from metadata header trest

parent 4b93d856
...@@ -71,7 +71,7 @@ func testArtifactsUploadServer(t *testing.T, tempPath string) *httptest.Server { ...@@ -71,7 +71,7 @@ func testArtifactsUploadServer(t *testing.T, tempPath string) *httptest.Server {
w.WriteHeader(404) w.WriteHeader(404)
return return
} }
if !bytes.HasPrefix(metadata[4:], []byte(metadataHeader)) { if !bytes.HasPrefix(metadata, []byte(metadataHeaderPrefix+metadataHeader)) {
w.WriteHeader(400) w.WriteHeader(400)
return return
} }
......
...@@ -19,6 +19,7 @@ type metadata struct { ...@@ -19,6 +19,7 @@ type metadata struct {
Comment string `json:"comment,omitempty"` Comment string `json:"comment,omitempty"`
} }
const metadataHeaderPrefix = "\x00\x00\x00&" // length of string below, encoded properly
const metadataHeader = "GitLab Build Artifacts Metadata 0.0.2\n" const metadataHeader = "GitLab Build Artifacts Metadata 0.0.2\n"
func newMetadata(file *zip.File) metadata { func newMetadata(file *zip.File) metadata {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment