diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 674e7ed..28ec42d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,7 +75,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] ansible-core-version: ["2.16.14"] runs-on: "ubuntu-latest" env: @@ -159,7 +159,7 @@ jobs: strategy: fail-fast: true matrix: - python-version: ["3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] ansible-core-version: ["2.16.14"] runs-on: "ubuntu-latest" env: diff --git a/schema_enforcer/utils.py b/schema_enforcer/utils.py index 32ebad9..9078e16 100755 --- a/schema_enforcer/utils.py +++ b/schema_enforcer/utils.py @@ -5,6 +5,7 @@ import glob from collections.abc import Mapping, Sequence import importlib +from urllib import parse as urlparse from ruamel.yaml import YAML from ruamel.yaml.scalarstring import DoubleQuotedScalarString as DQ @@ -374,10 +375,9 @@ def load_file(filename, file_type=None): if not file_type: file_type = "json" if filename.endswith(".json") else "yaml" - # When called from JsonRef, filename will contain a URI not just a local file, - # but this function only handles local files. See jsonref.JsonLoader for a fuller implementation - if filename.startswith("file:///"): - filename = filename.replace("file://", "") + # When called from JsonRef, filename will contain a file URI not just a local path + if filename.startswith("file:"): + filename = urlparse.urlparse(filename).path handler = YAML_HANDLER if file_type == "yaml" else json with open(filename, "r", encoding="utf-8") as fileh: