docker: parse registry also

This commit is contained in:
Girish Ramakrishnan
2024-12-14 14:10:29 +01:00
parent 0bd1aac0ef
commit 0008e5a83b
2 changed files with 8 additions and 6 deletions

View File

@@ -690,8 +690,10 @@ function parseImageRef(ref) {
// a ref is like registry.docker.com/cloudron/base:4.2.0@sha256:46da2fffb36353ef714f97ae8e962bd2c212ca091108d768ba473078319a47f4
// registry.docker.com is registry name . cloudron is namespace . base is image name . cloudron/base is repository path
// registry.docker.com/cloudron/base is fullRepositoryName
const result = { fullRepositoryName: null, tag: null, digest: null };
const result = { fullRepositoryName: null, registry: null, tag: null, digest: null };
result.fullRepositoryName = ref.split(/[:@]/)[0];
const parts = result.fullRepositoryName.split('/');
result.registry = parts.length === 3 ? parts[0] : null;
let remaining = ref.substr(result.fullRepositoryName.length);
if (remaining.startsWith(':')) {
result.tag = remaining.substr(1).split('@', 1)[0];