Skip to content

fetch.txt validation fails with file://<PATH> lines #153

Closed

Description

@avivace

BagIt validation fails with "Malformed URLs" when fetch.txt contains lines such as "file:///etc/hosts" while the BagIt specification mentions that fetch.txt should accept any URI according to RFC3986, which says that file paths when no hostname is specified should be written as e.g. file:///etc/host.

See also: https://en.wikipedia.org/wiki/File_URI_scheme

The problem is at https://github.com/LibraryOfCongress/bagit-python/blob/master/bagit.py#L775, since a parsing error is thrown whatever a URL yields no 'netloc', which is obviosuly set to an empty string when the pointed resource is in the local file system

Regardless, I do think that throwing a Parsing error whatever the actual parsing returned is wrong and should be changed

Activity

  1. acdha commented on Nov 12, 2021

    @acdha
    Member

    Good catch — if you can send a pull request it should be as simple as adding an exception for the file schema. Clearly we also need to get a test case for this, probably also in this repository as well since that's explicitly allowed by the spec.

    https://github.com/LibraryOfCongress/bagit-conformance-suite/

  2. avivace commented on Nov 12, 2021

    @avivace
    ContributorAuthor

    Good catch — if you can send a pull request it should be as simple as adding an exception for the file schema. Clearly we also need to get a test case for this, probably also in this repository as well since that's explicitly allowed by the spec.

    https://github.com/LibraryOfCongress/bagit-conformance-suite/

    Yes! I can work on a PR next week :D

  3. acdha commented on Nov 12, 2021

    @acdha
    Member

    Good catch — if you can send a pull request it should be as simple as adding an exception for the file schema. Clearly we also need to get a test case for this, probably also in this repository as well since that's explicitly allowed by the spec.
    https://github.com/LibraryOfCongress/bagit-conformance-suite/

    Yes! I can work on a PR next week :D

    Thanks, much appreciated!

  4. avivace commented on Dec 22, 2021

    @avivace
    ContributorAuthor

    @acdha Did you have the chance to take a look at the PR?

  5. avivace commented on Jul 14, 2023

    @avivace
    ContributorAuthor

    @acdha do we have any news here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions