* [pve-devel] [PATCH manager v2 0/2] ui: storage oci pull: optimize and cleanup reference regex
@ 2025-11-19 13:52 Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 1/2] ui: storage oci pull: optimize " Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 2/2] ui: storage oci pull: split up long one-line regex Filip Schauer
0 siblings, 2 replies; 3+ messages in thread
From: Filip Schauer @ 2025-11-19 13:52 UTC (permalink / raw)
To: pve-devel
Changed in v2:
* remove unnecessary backslashes from regex ("\\/" becomes "/")
* ran `make tidy`
Filip Schauer (2):
ui: storage oci pull: optimize reference regex
ui: storage oci pull: split up long one-line regex
www/manager6/storage/TemplateView.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 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] 3+ messages in thread* [pve-devel] [PATCH manager v2 1/2] ui: storage oci pull: optimize reference regex
2025-11-19 13:52 [pve-devel] [PATCH manager v2 0/2] ui: storage oci pull: optimize and cleanup reference regex Filip Schauer
@ 2025-11-19 13:52 ` Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 2/2] ui: storage oci pull: split up long one-line regex Filip Schauer
1 sibling, 0 replies; 3+ messages in thread
From: Filip Schauer @ 2025-11-19 13:52 UTC (permalink / raw)
To: pve-devel
Simplify the regex used to match an OCI registry reference and avoid
catastrophic backtracking in cases such as:
"registry.fedoraproject.org/fedora:"
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
No changes since v1
www/manager6/storage/TemplateView.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/www/manager6/storage/TemplateView.js b/www/manager6/storage/TemplateView.js
index 9f313a0c..71a68b88 100644
--- a/www/manager6/storage/TemplateView.js
+++ b/www/manager6/storage/TemplateView.js
@@ -218,11 +218,11 @@ Ext.define('PVE.storage.OciRegistryPull', {
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}))?$/;
+ /^((?:[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];
+ let tag = matches[2];
return [ref, tag];
}
return undefined;
--
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] 3+ messages in thread* [pve-devel] [PATCH manager v2 2/2] ui: storage oci pull: split up long one-line regex
2025-11-19 13:52 [pve-devel] [PATCH manager v2 0/2] ui: storage oci pull: optimize and cleanup reference regex Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 1/2] ui: storage oci pull: optimize " Filip Schauer
@ 2025-11-19 13:52 ` Filip Schauer
1 sibling, 0 replies; 3+ messages in thread
From: Filip Schauer @ 2025-11-19 13:52 UTC (permalink / raw)
To: pve-devel
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
Changed in v2:
* remove unnecessary backslashes from regex ("\\/" becomes "/")
* ran `make tidy`
www/manager6/storage/TemplateView.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/www/manager6/storage/TemplateView.js b/www/manager6/storage/TemplateView.js
index 71a68b88..e0ba9e2f 100644
--- a/www/manager6/storage/TemplateView.js
+++ b/www/manager6/storage/TemplateView.js
@@ -217,8 +217,12 @@ Ext.define('PVE.storage.OciRegistryPull', {
},
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])?))*(?::\d+)?\/)?[a-z\d]+(?:(?:[._]|__|-+)[a-z\d]+)*(?:\/[a-z\d]+(?:(?:[._]|__|-+)[a-z\d]+)*)*)(?::(\w[\w.-]{0,127}))?$/;
+ const re = new RegExp(
+ '^((?:[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];
--
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] 3+ messages in thread
end of thread, other threads:[~2025-11-19 13:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-19 13:52 [pve-devel] [PATCH manager v2 0/2] ui: storage oci pull: optimize and cleanup reference regex Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 1/2] ui: storage oci pull: optimize " Filip Schauer
2025-11-19 13:52 ` [pve-devel] [PATCH manager v2 2/2] ui: storage oci pull: split up long one-line regex Filip Schauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox