Project

Profile

Help

Bug #6273

closed

White space in file path causing an error.

Added by Daniel Haley about 1 year ago. Updated 10 months ago.

Status:
Closed
Priority:
Low
Category:
C++ API
Start date:
2023-12-01
Due date:
% Done:

100%

Estimated time:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Found in version:
12.4
Fixed in version:
12.4.2
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Possibly related to: https://saxonica.plan.io/issues/6143

I'm seeing differences in how spaces in paths are handled between 12.3.0 and 12.4.1. Especially with stylesheet_file, input_file, and output_file args.

Here is a sample Python. The stylesheet ident.xsl is just a 3.0 identity transform (<xsl:mode on-no-match="shallow-copy"/>) and ident.xml is just <foo/>.

Python (3.11.6 on Windows 10)

import os
from pathlib import Path
from saxonche import *

with PySaxonProcessor(license=False) as proc:
    print(f"Processor version: {proc.version}")

    xsltproc = proc.new_xslt30_processor()

    executable = xsltproc.compile_stylesheet(stylesheet_file=r"C:\Users\Dan Haley\Desktop\try_saxon\ident.xsl")

    results = executable.transform_to_string(source_file=r"C:\Users\Dan Haley\Desktop\try_saxon\ident.xml")

    print(results)

Saxon 12.4

Doesn't work:

  • r"C:\Users\Dan Haley\Desktop\try_saxon\ident.xsl"
  • "file:///C:/Users/Dan%20Haley/Desktop/try_saxon/ident.xsl"
  • "C:/Users/Dan Haley/Desktop/try_saxon/ident.xsl"
  • "C:/Users/Dan%20Haley/Desktop/try_saxon/ident.xsl"
  • Path(r"C:\Users\Dan Haley\Desktop\try_saxon", "ident.xsl").absolute().as_uri()

Works:

  • "file:///C:/Users/Dan Haley/Desktop/try_saxon/ident.xsl"

Saxon 12.3

Doesn't work:

  • "file:///C:/Users/Dan Haley/Desktop/try_saxon/ident.xsl"

Works:

  • r"C:\Users\Dan Haley\Desktop\try_saxon\ident.xsl"
  • "file:///C:/Users/Dan%20Haley/Desktop/try_saxon/ident.xsl"
  • "C:/Users/Dan Haley/Desktop/try_saxon/ident.xsl"
  • "C:/Users/Dan%20Haley/Desktop/try_saxon/ident.xsl"
  • Path(r"C:\Users\Dan Haley\Desktop\try_saxon", "ident.xsl").absolute().as_uri()

I did notice that in the exception the space seems like it's getting double percent encoded; a single space is encoded as %2520 (like " " -> %20 -> %2520):


Files

clipboard-202312011605-jrtcw.png (43.8 KB) clipboard-202312011605-jrtcw.png Daniel Haley, 2023-12-02 00:05

Please register to edit this issue

Also available in: Atom PDF