Skip to content

OAI: If item identifier has special characters, temp metadata filename doesn't match filegetter #508

@bondjimbond

Description

@bondjimbond

I'm doing an OAI migration, and running into problems in src/fetchers/Oaipmh.php.

The Fetcher assumes that the $identifier and $record_key are the same value, but they aren't necessarily.

If the item identifier contains special characters (e.g. oai:thisvancouver.vpl.ca:islandora_1910), MIK treats it differently in different contexts.

When writing the temporary metadata files: https://github.com/MarcusBarnes/mik/blob/master/src/fetchers/Oaipmh.php#L80-L82

Resulting filename: oai%3Athisvancouver.vpl.ca%3Aislandora_1910.metadata.

But the $record_key that is used everywhere else in the code looks like this: oai_thisvancouver.vpl.ca_islandora_1910.

So you end up with problems like this:

ErrorException.ERROR: ErrorException {"message":"file_get_contents(/Volumes/Arca/tmp/oaitest_temp/oai_thisvancouver.vpl.ca_islandora_410.metadata): failed to open stream: No such file or directory","code":{"record_key":"oai_thisvancouver.vpl.ca_islandora_1910","raw_metadata_path":"/Volumes/Arca/tmp/oaitest_temp/oai_thisvancouver.vpl.ca_islandora_1910.metadata","dom":"[object] (DOMDocument: {})"},"severity":2,"file":"/Users/brandon/sfuvault/mik/src/filegetters/OaipmhModsXpath.php","line":56} []

Because the filegetter is looking for $record_key.metadata, while the actual filename is $identifier.metadata. So it can't actually find the file.

So... how the heck do we fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions