all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing
@ 2025-11-18 16:26 Filip Schauer
  2025-11-18 16:26 ` [pve-devel] [PATCH manager 1/2] ui: storage: oci registry pull: fix reference parsing Filip Schauer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Filip Schauer @ 2025-11-18 16:26 UTC (permalink / raw)
  To: pve-devel

Filip Schauer (2):
  ui: storage: oci registry pull: fix reference parsing
  ui: storage: oci registry pull: add reference validator

 www/manager6/storage/TemplateView.js | 38 +++++++++++++++++++++++-----
 1 file changed, 31 insertions(+), 7 deletions(-)

-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 1/2] ui: storage: oci registry pull: fix reference parsing
  2025-11-18 16:26 [pve-devel] [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Filip Schauer
@ 2025-11-18 16:26 ` Filip Schauer
  2025-11-18 16:26 ` [pve-devel] [PATCH manager 2/2] ui: storage: oci registry pull: add reference validator Filip Schauer
  2025-11-18 18:32 ` [pve-devel] applied: [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Filip Schauer @ 2025-11-18 16:26 UTC (permalink / raw)
  To: pve-devel

Fixes an issue where pasting an OCI image reference with a additional
prefix (for example docker://registry.fedoraproject.org/fedora:latest)
into the reference field caused the tag parser to split the string
incorrectly. With this patch the tag is only moved when a valid OCI
reference is entered.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 www/manager6/storage/TemplateView.js | 30 +++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/www/manager6/storage/TemplateView.js b/www/manager6/storage/TemplateView.js
index d570efb4..6ce6d1f6 100644
--- a/www/manager6/storage/TemplateView.js
+++ b/www/manager6/storage/TemplateView.js
@@ -201,15 +201,31 @@ Ext.define('PVE.storage.OciRegistryPull', {
             let view = me.getView();
             let tagField = view.down('[name=tag]');
             tagField.setComboItems([]);
+            let matches = me.parseReference(value);
+            if (matches) {
+                let ref = matches[0];
+                let tag = matches[1];
+
+                if (tag) {
+                    field.setValue(ref);
+                    tagField.setValue(tag);
+                    tagField.focus();
+                } else {
+                    tagField.clearValue();
+                }
+            }
+        },
 
-            let parts = value.split(':');
-            if (parts.length > 1) {
-                field.setValue(parts[0]);
-                tagField.setValue(parts[1]);
-                tagField.focus();
-            } else {
-                tagField.clearValue();
+        parseReference: function (value) {
+            const re =
+                /^((?:(?:[a-zA-Z\d]|[a-zA-Z\d][a-zA-Z\d-]*[a-zA-Z\d])(?:\.(?:[a-zA-Z\d]|[a-zA-Z\d][a-zA-Z\d-]*[a-zA-Z\d]))*(?::\d+)?\/)?[a-z\d]+(?:(?:[._]|__|[-]*)[a-z\d]+)*(?:\/[a-z\d]+(?:(?:[._]|__|[-]*)[a-z\d]+)*)*)(:(\w[\w.-]{0,127}))?$/;
+            let matches = value.match(re);
+            if (matches) {
+                let ref = matches[1];
+                let tag = matches[3];
+                return [ref, tag];
             }
+            return undefined;
         },
 
         queryTags: function (field) {
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH manager 2/2] ui: storage: oci registry pull: add reference validator
  2025-11-18 16:26 [pve-devel] [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Filip Schauer
  2025-11-18 16:26 ` [pve-devel] [PATCH manager 1/2] ui: storage: oci registry pull: fix reference parsing Filip Schauer
@ 2025-11-18 16:26 ` Filip Schauer
  2025-11-18 18:32 ` [pve-devel] applied: [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Filip Schauer @ 2025-11-18 16:26 UTC (permalink / raw)
  To: pve-devel

Require a valid OCI reference before allowing submission.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 www/manager6/storage/TemplateView.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/www/manager6/storage/TemplateView.js b/www/manager6/storage/TemplateView.js
index 6ce6d1f6..77418d6c 100644
--- a/www/manager6/storage/TemplateView.js
+++ b/www/manager6/storage/TemplateView.js
@@ -281,6 +281,14 @@ Ext.define('PVE.storage.OciRegistryPull', {
                             listeners: {
                                 change: 'onReferenceChange',
                             },
+                            validator: function (value) {
+                                let me = this;
+                                let controller = me.up('pveOciRegistryPull').getController();
+                                if (controller.parseReference(value)) {
+                                    return true;
+                                }
+                                return gettext('Invalid OCI Registry Reference');
+                            },
                         },
                         {
                             xtype: 'button',
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing
  2025-11-18 16:26 [pve-devel] [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Filip Schauer
  2025-11-18 16:26 ` [pve-devel] [PATCH manager 1/2] ui: storage: oci registry pull: fix reference parsing Filip Schauer
  2025-11-18 16:26 ` [pve-devel] [PATCH manager 2/2] ui: storage: oci registry pull: add reference validator Filip Schauer
@ 2025-11-18 18:32 ` Thomas Lamprecht
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-11-18 18:32 UTC (permalink / raw)
  To: pve-devel, Filip Schauer

On Tue, 18 Nov 2025 17:26:19 +0100, Filip Schauer wrote:
> Filip Schauer (2):
>   ui: storage: oci registry pull: fix reference parsing
>   ui: storage: oci registry pull: add reference validator
> 
> www/manager6/storage/TemplateView.js | 38 +++++++++++++++++++++++-----
>  1 file changed, 31 insertions(+), 7 deletions(-)
> 
> [...]

Applied, thanks!

[1/2] ui: storage: oci registry pull: fix reference parsing
      commit: fad3dc25584824bfb824c34d1109351643d3ee70
[2/2] ui: storage: oci registry pull: add reference validator
      commit: 65dc2b2d95f83dd73ca126b0c54cd8a3588f9695


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-18 18:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-18 16:26 [pve-devel] [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Filip Schauer
2025-11-18 16:26 ` [pve-devel] [PATCH manager 1/2] ui: storage: oci registry pull: fix reference parsing Filip Schauer
2025-11-18 16:26 ` [pve-devel] [PATCH manager 2/2] ui: storage: oci registry pull: add reference validator Filip Schauer
2025-11-18 18:32 ` [pve-devel] applied: [PATCH manager 0/2] ui: storage: oci registry pull: fix reference validation/parsing Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal