You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2022/05/12 09:26:50 UTC

[jena] branch main updated: JENA-2241: Fix for reading URLs

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

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/main by this push:
     new f19ab4da52 JENA-2241: Fix for reading URLs
     new 42a89ac47a Merge pull request #1298 from afs/riot-files
f19ab4da52 is described below

commit f19ab4da52304328b07ea0e9fe78d3b1a214c5e4
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Thu May 12 10:12:10 2022 +0100

    JENA-2241: Fix for reading URLs
---
 jena-cmds/src/main/java/riotcmd/CmdLangParse.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/jena-cmds/src/main/java/riotcmd/CmdLangParse.java b/jena-cmds/src/main/java/riotcmd/CmdLangParse.java
index 678728709b..de5e7aac0e 100644
--- a/jena-cmds/src/main/java/riotcmd/CmdLangParse.java
+++ b/jena-cmds/src/main/java/riotcmd/CmdLangParse.java
@@ -37,6 +37,7 @@ import org.apache.jena.cmd.ArgDecl;
 import org.apache.jena.cmd.CmdException;
 import org.apache.jena.cmd.CmdGeneral;
 import org.apache.jena.irix.IRIException;
+import org.apache.jena.irix.IRIs;
 import org.apache.jena.rdfs.RDFSFactory;
 import org.apache.jena.rdfs.SetupRDFS;
 import org.apache.jena.riot.* ;
@@ -247,10 +248,12 @@ public abstract class CmdLangParse extends CmdGeneral
             filename = "stdin";
             builder.source(System.in);
         } else {
-            // Convert spaces and other characters in file names.
-            // File handling will reverse to open the file correctly
-            // but for base name generation we want the %20 form.
-            filename = IRILib.filenameToIRI(filename);
+            String scheme = IRIs.scheme(filename);
+            if ( scheme == null || scheme.equalsIgnoreCase("file") )
+                // Convert spaces and other characters in file names.
+                // File handling will reverse the transformation to open
+                // the file correctly but for base name generation we want the %20 form.
+                filename = IRILib.filenameToIRI(filename);
             builder.source(filename);
         }
         return parseRIOT(builder, filename);