Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
syncpool "github.com/mostynb/zstdpool-syncpool"
)

var blobNameSHA256 = regexp.MustCompile("^/?(.*/)?(ac/|cas/)([a-f0-9]{64})$")
var blobNameSHA256 = regexp.MustCompile("^/?(.*/)?((?:ac|cas(?:\\.v2)?)/)([a-f0-9]{64})$")

var decoder, _ = zstd.NewReader(nil) // TODO: raise WithDecoderConcurrency ?

Expand Down Expand Up @@ -100,14 +100,14 @@ func parseRequestURL(url string, validateAC bool) (kind cache.EntryKind, hash st

parts := m[2:]
if len(parts) != 2 {
err := fmt.Errorf("the path '%s' is invalid. expected (ac/|cas/)sha256",
err := fmt.Errorf("the path '%s' is invalid. expected (ac/|cas(.v2)?/)sha256",
html.EscapeString(url))
return 0, "", "", err
}

// The regex ensures that parts[0] can only be "ac/" or "cas/"
// The regex ensures that parts[0] can only be "ac/" or "cas(.v2)?/"
hash = parts[1]
if parts[0] == "cas/" {
if parts[0] == "cas/" || parts[0] == "cas.v2/" {
return cache.CAS, hash, instance, nil
}

Expand Down