From 74ac039f8b6cb91f9385ecfd9ec651cda2efa9e9 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Wed, 24 Jun 2020 12:24:45 -0400 Subject: [PATCH] pipelines: Add trailing slash to URI so that last component is not removed during dereferencing --- kingfisher_scrapy/pipelines.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kingfisher_scrapy/pipelines.py b/kingfisher_scrapy/pipelines.py index 98e34cae..68172e69 100644 --- a/kingfisher_scrapy/pipelines.py +++ b/kingfisher_scrapy/pipelines.py @@ -17,10 +17,10 @@ def __init__(self): self.files = set() self.file_items = set() schema_path = pathlib.Path(os.path.dirname(os.path.abspath(__file__)), 'item_schema') - for item in ['File', 'FileError', 'FileItem']: + for item in ('File', 'FileError', 'FileItem'): filename = os.path.join(schema_path, f'{item}.json') with open(filename) as f: - schema = jsonref.load(f, base_uri=pathlib.Path(schema_path, 'item_schema').as_uri()) + schema = jsonref.load(f, base_uri=schema_path.as_uri() + '/') self.validators[item] = Draft4Validator(schema, format_checker=FormatChecker()) def process_item(self, item, spider):