support docker official images

This commit is contained in:
Singee 2023-06-29 15:33:58 +08:00
parent 11ceb5fc85
commit 554ee35d6b
No known key found for this signature in database
GPG Key ID: 4EC3FD10E03041D7

View File

@ -43,9 +43,10 @@ function hostByOrgName(orgName: string|null): string {
function rewritePath(orgName: string | null, pathname: string): string { function rewritePath(orgName: string | null, pathname: string): string {
let splitedPath = pathname.split("/"); let splitedPath = pathname.split("/");
// /v2/repo -> /v2/library/repo // /v2/repo/manifests/xxx -> /v2/library/repo/manifests/xxx
if (orgName === null && splitedPath.length === 3) { // /v2/repo/blobs/xxx -> /v2/library/repo/blobs/xxx
splitedPath = [splitedPath[0], splitedPath[1], "library", splitedPath[2]] if (orgName === null && splitedPath.length === 5 && (splitedPath[3] === "manifests" || splitedPath[3] === "blobs")) {
splitedPath = [splitedPath[0], splitedPath[1], "library", splitedPath[2], splitedPath[3], splitedPath[4]]
} }
return splitedPath.join("/") return splitedPath.join("/")