Project

Profile

Help

Bug #2397

closed

document-uri() returns bad URL on Windows but Not Mac

Added by Debbie Lockett over 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Low
Category:
-
Sprint/Milestone:
Start date:
2015-06-12
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

Description

Problem reported by Eliot Kimber on saxon-help list (2015-06-10).

Repo provided, and issue reproduced on Windows machine. The problem is actually in the document() function: if the document URI (href) supplied contains spaces, then it may not resolve correctly.

Mike's summary:

The document() function (and doc() for that matter) do two things:

(a) they check in a document pool to see if the URI is already known

(b) if not, they call the URIResolver to dereference the URI and fetch the resource

The URIResolver is defined to take the href and baseURI as separate parameters, so the URIResolver has its own logic to combine them into an absolute URI. But before calling it, we need to see if the absolute URI is present in the document pool, so there’s separate logic to construct an absolute URI for that purpose. It turns out that the two bits of code to combine href and baseURI are doing it slightly differently: the URIResolver logic escapes any spaces in the href to %20, but the document pool logic does not; instead it gets an exception from URI.resolve() and uses a fallback algorithm to concatenate the base URI and relative URI with “/../“ as a separator. It’s this fallback URI that you are seeing in the result from the document-uri() function.

According to the spec, the argument to document() should be a URI, which means it can’t contain unescaped spaces. We’re trying to be a bit friendlier than that, but we’re not entirely succeeding. We’ll fix this by doing the “escape spaces” logic on the document pool path as well as the URIResolver path. Meanwhile, please ensure that the value you pass to document() is a valid URI.

We haven’t explored all the variations on why this bug is occurring on some paths but not others, and on some operating systems and not others.

Actions #1

Updated by Debbie Lockett over 9 years ago

  • Status changed from New to Resolved

Patch committed on 9.6 and 9.7 development branch (to escape spaces in the URI supplied to the document() function, as suggested above).

Actions #2

Updated by O'Neil Delpratt over 9 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.7

Bug fix applied in the Saxon 9.6.0.7 maintenance release.

Actions #3

Updated by O'Neil Delpratt about 9 years ago

  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.7 added
Actions #4

Updated by O'Neil Delpratt about 9 years ago

  • Sprint/Milestone set to 9.6.0.7

Please register to edit this issue

Also available in: Atom PDF