bagit-python
bagit-python copied to clipboard
Allow fetch.txt with file URLs to validate
It looks like it passes all the tests (python setup.py test doesn't return any error) and it also succeds to validate the bag I added in https://github.com/LibraryOfCongress/bagit-conformance-suite/pull/14 with this kind of entries in the fetch.txt:
file:///home/avivace/cern/example_bags/source/sachiel.png 42000 sachiel.png
It should effectively fix https://github.com/LibraryOfCongress/bagit-python/issues/153.
The fetch.txt validation now passes when:
- The URL scheme resolves to "file" after parsing (no value need for netloc in this case)
- The schema resolves to anything AND the netloc has a value too
if not (all((parsed_url.scheme, parsed_url.netloc)) or parsed_url.scheme == "file"):