File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55import glob
66from collections .abc import Mapping , Sequence
77import importlib
8+ from urllib import parse as urlparse
89
910from ruamel .yaml import YAML
1011from ruamel .yaml .scalarstring import DoubleQuotedScalarString as DQ
@@ -374,10 +375,9 @@ def load_file(filename, file_type=None):
374375 if not file_type :
375376 file_type = "json" if filename .endswith (".json" ) else "yaml"
376377
377- # When called from JsonRef, filename will contain a URI not just a local file,
378- # but this function only handles local files. See jsonref.JsonLoader for a fuller implementation
379- if filename .startswith ("file:///" ):
380- filename = filename .replace ("file://" , "" )
378+ # When called from JsonRef, filename will contain a file URI not just a local path
379+ if filename .startswith ("file:" ):
380+ filename = urlparse .urlparse (filename ).path
381381
382382 handler = YAML_HANDLER if file_type == "yaml" else json
383383 with open (filename , "r" , encoding = "utf-8" ) as fileh :
You can’t perform that action at this time.
0 commit comments