openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dube...@apache.org
Subject [incubator-openwhisk] branch master updated: Allow more special characters in EntityName. (#3644)
Date Mon, 14 May 2018 17:37:13 GMT
This is an automated email from the ASF dual-hosted git repository.

dubeejw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git


The following commit(s) were added to refs/heads/master by this push:
     new 2ef6e4d  Allow more special characters in EntityName. (#3644)
2ef6e4d is described below

commit 2ef6e4d235745ad2f24527482c8f9a58c0ca5ea0
Author: Markus Thömmes <markusthoemmes@me.com>
AuthorDate: Mon May 14 19:37:09 2018 +0200

    Allow more special characters in EntityName. (#3644)
    
    
    * Add `&` to the allowed set of charecters for entities.
---
 .../scala/src/main/scala/whisk/core/entity/EntityPath.scala |  4 ++--
 .../src/test/scala/whisk/core/entity/test/SchemaTests.scala | 13 +++++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/common/scala/src/main/scala/whisk/core/entity/EntityPath.scala b/common/scala/src/main/scala/whisk/core/entity/EntityPath.scala
index c4836c3..0262f10 100644
--- a/common/scala/src/main/scala/whisk/core/entity/EntityPath.scala
+++ b/common/scala/src/main/scala/whisk/core/entity/EntityPath.scala
@@ -192,10 +192,10 @@ protected[core] object EntityName {
 
   /**
    * Allowed path part or entity name format (excludes path separator): first character
-   * is a letter|digit|underscore, followed by one or more allowed characters in [\w@ .-].
+   * is a letter|digit|underscore, followed by one or more allowed characters in [\w@ .&-].
    * The name may not have trailing white space.
    */
-  protected[core] val REGEX = raw"\A([\w]|[\w][\w@ .-]{0,${ENTITY_NAME_MAX_LENGTH - 2}}[\w@.-])\z"
+  protected[core] val REGEX = raw"\A([\w]|[\w][\w@ .&-]{0,${ENTITY_NAME_MAX_LENGTH -
2}}[\w@.&-])\z"
   private val entityNamePattern = REGEX.r.pattern // compile once
   protected[core] def entityNameMatcher(s: String): Matcher = entityNamePattern.matcher(s)
 
diff --git a/tests/src/test/scala/whisk/core/entity/test/SchemaTests.scala b/tests/src/test/scala/whisk/core/entity/test/SchemaTests.scala
index 99fe131..6ee2b24 100644
--- a/tests/src/test/scala/whisk/core/entity/test/SchemaTests.scala
+++ b/tests/src/test/scala/whisk/core/entity/test/SchemaTests.scala
@@ -235,14 +235,15 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with ExecHelpers
with Mat
     val paths = Seq(
       "a",
       "a b",
-      "a@b.c",
+      "a@b.c&d",
+      "a@&b",
       "_a",
       "_",
       "_ _",
       "a0",
       "a 0",
       "a.0",
-      "a@@",
+      "a@@&",
       "0",
       "0.0",
       "0.0.0",
@@ -265,9 +266,17 @@ class SchemaTests extends FlatSpec with BeforeAndAfter with ExecHelpers
with Mat
       " /",
       "/ ",
       "0 ",
+      "a=2b",
       "_ ",
+      "a?b",
+      "x#x",
+      "a§b",
       "a  ",
+      "a()b",
+      "a{}b",
       "a \t",
+      "-abc",
+      "&abc",
       "a\n",
       "a" * (EntityName.ENTITY_NAME_MAX_LENGTH + 1))
     paths.foreach { p =>

-- 
To stop receiving notification emails like this one, please contact
dubeejw@apache.org.

Mime
View raw message