Skip to content

Commit e1220b5

Browse files
committed
Fixed incorrect handling of nested paths
1 parent 3a5ff85 commit e1220b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/adapter/harbor.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ func (h *Harbor) ManifestSecurity(w http.ResponseWriter, r *http.Request) {
8888
}).Infof("fetching manifest information")
8989
uri := fmt.Sprintf("https://%s", r.Host)
9090
if registry != "" {
91-
namespace = filepath.Join(registry, namespace)
91+
reponame = url.PathEscape(filepath.Join(namespace, reponame))
92+
namespace = registry
9293
}
9394
report, err := h.vulnerabilityInfo(r.Context(), uri, namespace, reponame, digest, features, vulnerabilities)
9495
if err != nil {
@@ -109,7 +110,8 @@ func (h *Harbor) ImageSecurity(w http.ResponseWriter, r *http.Request) {
109110
"imageid": imageid,
110111
}).Infof("fetching image information")
111112
if registry != "" {
112-
namespace = filepath.Join(registry, namespace)
113+
reponame = url.PathEscape(filepath.Join(namespace, reponame))
114+
namespace = registry
113115
}
114116
uri := fmt.Sprintf("https://%s", r.Host)
115117
report, err := h.vulnerabilityInfo(r.Context(), uri, namespace, reponame, imageid, features, vulnerabilities)

0 commit comments

Comments
 (0)