Project

Profile

Help

Bug #4925

closed

The -s option resolves spaces incorrectly in filenames

Added by Norm Tovey-Walsh over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-03-03
Due date:
% Done:

100%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
2
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

From https://saxonica.plan.io/boards/5/topics/8145?pn=1

Martin Honnen writes:

I thought I had reported a problem for Saxon JS 2.0: when I run e.g. xslt3 -s:input.xml -xsl:sheet.xsl -t on Windows where I am in a directory that contains a space in the path (e.g. C:\Users\John Doe\folder\subfolder) with 2.0 and still with 2.1 I get an error that indicates that the source is failing to be loaded from C:/Users/John%20/Doe/folder/subfolder/input.xml (note the percentage encoding of the space) e.g.

Saxon-JS 2.1 from Saxonica Node.js version v12.18.0 Compiling stylesheet C:\Users\John Doe\folder\subfolder\sheet.xsl Stylesheet compilation time: 0.199s Transformation failed: Error SXJS0006 Failed to read XML source input (Failed to read C:/Users/John%20/Doe/folder/subfolder/input.xml(no such file))

So it appears the relative stylesheet URI (or is Saxon JS only treating that option as a file name?) works fine but the relative input URI fails.

https://saxonica.plan.io/issues/4590 is kind of related although that is an output URI not an input URI.

Actions #1

Updated by Philip Fearon over 3 years ago

This problem (using Saxon-JS 2.1), with space characters escaped to '%20' in paths, appears to affect all paths supplied in the command-line.

For example, on macos:

black2:saxonjs-test philipf$ node node_modules/xslt3/xslt3.js -xsl:transform.xsl "-s:new dir/input.xml" -o:result.xml
Transformation failed: Error SXJS0006
    Failed to read XML source input (Failed to read /Users/philipf/dev/saxonjs-test/new%20dir/input.xml(no such file))

It seems command-line paths are converted to URIs but not correctly restored back again to file paths later on. Would url.fileURLToPath(url) (https://nodejs.org/api/url.html#url_url_fileurltopath_url) help in this case?

Actions #2

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from New to In Progress
Actions #3

Updated by Norm Tovey-Walsh over 3 years ago

I've resolved the bug as reported, but I've noticed a few other places where there seems to be inconsistency about URIs vs files and even whether URIs are allowed.

Actions #4

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from In Progress to Resolved
  • Fix Committed on JS Branch 2 added

Resolved in the main 2.x branch.

Actions #5

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from Resolved to Closed

This issue has been resolved in the Saxon 2.2 maintenance release.

Actions #6

Updated by Debbie Lockett over 3 years ago

  • % Done changed from 0 to 100
  • Fixed in JS Release set to Saxon-JS 2.2

Please register to edit this issue

Also available in: Atom PDF Tracking page