Skip to content

Commit

Permalink
Update _worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu authored Aug 12, 2024
1 parent 3f2f161 commit dbe7a22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,9 @@ export default {
}

// 修改 /v2/ 请求路径
if (ns === 'docker.io' && /^\/v2\/[^/]+\/[^/]+\/[^/]+$/.test(url.pathname) && !/^\/v2\/library/.test(url.pathname)) {
url.pathname = url.pathname.replace(/\/v2\//, '/v2/library/');
if ( hub_host == 'registry-1.docker.io' && /^\/v2\/[^/]+\/[^/]+\/[^/]+$/.test(url.pathname) && !/^\/v2\/library/.test(url.pathname)) {
//url.pathname = url.pathname.replace(/\/v2\//, '/v2/library/');
url.pathname = '/v2/library/' + url.pathname.split('/v2/')[1];
console.log(`modified_url: ${url.pathname}`);
}

Expand Down

0 comments on commit dbe7a22

Please sign in to comment.