You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ki...@apache.org on 2024/03/27 12:02:46 UTC

(jena) branch gh-2370-2 updated (d3dca83614 -> f6c5d57ed4)

This is an automated email from the ASF dual-hosted git repository.

kinow pushed a change to branch gh-2370-2
in repository https://gitbox.apache.org/repos/asf/jena.git


 discard d3dca83614 GH-2370: Improve validation of dataset graph names
     new f6c5d57ed4 GH-2370: Improve validation of dataset graph names

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d3dca83614)
            \
             N -- N -- N   refs/heads/gh-2370-2 (f6c5d57ed4)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 jena-fuseki2/jena-fuseki-ui/src/views/dataset/Upload.vue | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


(jena) 01/01: GH-2370: Improve validation of dataset graph names

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kinow pushed a commit to branch gh-2370-2
in repository https://gitbox.apache.org/repos/asf/jena.git

commit f6c5d57ed4ad20de9f9af6a86b56821b630990d6
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Wed Mar 27 13:00:24 2024 +0100

    GH-2370: Improve validation of dataset graph names
---
 .../jena-fuseki-ui/src/views/dataset/Upload.vue    | 30 +++++++++++++++++-----
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Upload.vue b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Upload.vue
index 3f756315c3..433ff81269 100644
--- a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Upload.vue
+++ b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Upload.vue
@@ -60,7 +60,7 @@
                         placeholder="Leave blank for default graph"
                       />
                       <div class="invalid-feedback">
-                        Invalid graph name. Please remove any spaces.
+                        Invalid graph name. Please remove any spaces and encoded values.
                       </div>
                     </div>
                   </div>
@@ -416,15 +416,33 @@ export default {
       return this.validateGraphName() && this.validateFiles()
     },
     validateGraphName () {
-      // No spaces allowed in graph names.
-      const pattern = /^[^\s]+$/
       const graphName = this.$refs['dataset-graph-name'].value
-      if (graphName === '' || pattern.test(graphName)) {
+      // An empty graph name is OK.
+      if (graphName === '') {
         this.graphNameClasses = ['form-control is-valid']
         return true
       }
-      this.graphNameClasses = ['form-control is-invalid']
-      return false
+      // No spaces allowed in graph names.
+      const pattern = /^\S+$/
+      if (!pattern.test(graphName)) {
+        this.graphNameClasses = ['form-control is-invalid']
+        return false
+      }
+      // Only valid URIs allowed.
+      try {
+        new URL(graphName)
+      } catch {
+        this.graphNameClasses = ['form-control is-invalid']
+        return false
+      }
+      // Encoded components are not allowed.
+      if (decodeURI(graphName) !== decodeURIComponent(graphName)) {
+        this.graphNameClasses = ['form-control is-invalid']
+        return false
+      }
+      // If it reached this part, then it's a valid graph name.
+      this.graphNameClasses = ['form-control is-valid']
+      return true
     },
     validateFiles () {
       if (this.upload.files !== null && this.upload.files.length > 0) {