pystac icon indicating copy to clipboard operation
pystac copied to clipboard

Add `file://` to self links that don't have a protocol

Open jsignell opened this issue 1 year ago • 2 comments

Related Issue(s):

  • closes #1347

Description:

Pystac already coerces self links to absolute, so now it adds file:// as well.

Notes:

  • TODO: There are still some tests that are failing. Mostly having to do with normalize.
  • The json schema spec does define how "format": "iri" should be handled, but the Python implementation doesn't seem to validate it very well. For instance this passes:
from jsonschema import validate

validate("any-string", {"type": "string", "format": "iri", "minLength": 1})
  • Python in general seems rather bad at interpreting the file:// protocol. Python 3.13 adds some support to pathlib in https://docs.python.org/3/library/pathlib.html#pathlib.Path.from_uri

PR Checklist:

  • [ ] Pre-commit hooks and tests pass (run scripts/test)
  • [ ] Documentation has been updated to reflect changes, if applicable
  • [ ] This PR maintains or improves overall codebase code coverage.
  • [ ] Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

jsignell avatar Nov 05 '24 22:11 jsignell

Hey there, let me know if you want me to take on any of the todos above, and if so if I should PR to your branch. No worries if you'd rather just stay heads down!

KeynesYouDigIt avatar Nov 16 '24 19:11 KeynesYouDigIt

Hey there, let me know if you want me to take on any of the todos above, and if so if I should PR to your branch. No worries if you'd rather just stay heads down!

Yeah the more I have been thinking about this PR the more I think it should be considered a breaking change and wait until pystac 2.0. Part of the reason why I am leaning that way is because the jsonschema validation does not raise.

jsignell avatar Nov 20 '24 14:11 jsignell