[PATCH] issue #316: Only verify if path starts with '/'

From: Aline Manera <alinefm@br.ibm.com> Any character is allowed in a Linux path. So while creating a DIR storage pool we just need to make sure the path starts with '/' and backend will properly check if it exists on the system. Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js index 574cf5a..1e3e4b4 100644 --- a/ui/js/src/kimchi.storagepool_add_main.js +++ b/ui/js/src/kimchi.storagepool_add_main.js @@ -167,7 +167,7 @@ kimchi.validateDirForm = function () { kimchi.message.error.code('KCHPOOL6002E'); return false; } - if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) { + if (!/(^\/.*)$/.test(path)) { kimchi.message.error.code('KCHAPI6003E'); return false; } -- 1.7.10.4

Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> On 02/24/2014 01:21 PM, Aline Manera wrote:
From: Aline Manera <alinefm@br.ibm.com>
Any character is allowed in a Linux path. So while creating a DIR storage pool we just need to make sure the path starts with '/' and backend will properly check if it exists on the system.
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js index 574cf5a..1e3e4b4 100644 --- a/ui/js/src/kimchi.storagepool_add_main.js +++ b/ui/js/src/kimchi.storagepool_add_main.js @@ -167,7 +167,7 @@ kimchi.validateDirForm = function () { kimchi.message.error.code('KCHPOOL6002E'); return false; } - if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) { + if (!/(^\/.*)$/.test(path)) { kimchi.message.error.code('KCHAPI6003E'); return false; }

Even though "if (path[0] == '/')" is much simpler, that should work as well :-) Reviewed-by: Crístian Viana <vianac@linux.vnet.ibm.com> Am 24-02-2014 13:21, schrieb Aline Manera:
From: Aline Manera <alinefm@br.ibm.com>
Any character is allowed in a Linux path. So while creating a DIR storage pool we just need to make sure the path starts with '/' and backend will properly check if it exists on the system.
Signed-off-by: Aline Manera <alinefm@br.ibm.com>

From: Aline Manera <alinefm@br.ibm.com>
Any character is allowed in a Linux path. So while creating a DIR storage pool we just need to make sure the path starts with '/' and backend will properly check if it exists on the system.
Signed-off-by: Aline Manera <alinefm@br.ibm.com> --- ui/js/src/kimchi.storagepool_add_main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ui/js/src/kimchi.storagepool_add_main.js b/ui/js/src/kimchi.storagepool_add_main.js index 574cf5a..1e3e4b4 100644 --- a/ui/js/src/kimchi.storagepool_add_main.js +++ b/ui/js/src/kimchi.storagepool_add_main.js @@ -167,7 +167,7 @@ kimchi.validateDirForm = function () { kimchi.message.error.code('KCHPOOL6002E'); return false; } - if (!/((\/([0-9a-zA-Z-_\.]+)))$/.test(path)) { + if (!/(^\/.*)$/.test(path)) { if just verify path starts with '/',
Just a minor comment below On 02/25/2014 12:21 AM, Aline Manera wrote: path.startsWith("/") is OK. sure, your RE is also OK. :-)
kimchi.message.error.code('KCHAPI6003E'); return false; }
-- Thanks and best regards! Sheldon Feng(冯少合)<shaohef@linux.vnet.ibm.com> IBM Linux Technology Center
participants (4)
-
Aline Manera
-
Crístian Viana
-
Rodrigo Trujillo
-
Sheldon