SFULibrary / islandora_datastream_crud

Islandora Drush module for performing Create, Read, Update, and Delete operations on datastreams.
GNU General Public License v3.0
15 stars 15 forks source link

DSIDs with underscores are not named properly #67

Closed mjordan closed 5 years ago

mjordan commented 6 years ago

DSIDs containing underscores (e.g., sfuiritem_23_USAGE_DATA.usage) aren't recognized because the _ is used to explode the parts of the filename in https://github.com/SFULibrary/islandora_datastream_crud/blob/7.x/includes/utilities.inc#L126. Adding a '3' as the third parameter to explode() solves the problem. We probably should introduce a parameter to islandora_datastream_crud_push_datastreams that indicates how many pieces to explode the filename into.

theMusician commented 6 years ago

Thanks, this helped us out. Here is a patch file for use. issue-67.patch.zip

mjordan commented 5 years ago

@theMusician this issue also applies to PIDs with underscores, so I've come up with a fix that allows the use of _ in both PIDs and DSIDs. If you are so inclined, would you be interested in testing the code in the issue-67 branch? No sweat if you're not.

If you add the --filename_separator option with a character like ^ or # when you fetch or push datastreams, you can use _ anywhere you like in the DSID or PID. The section in the issue-67 branch's README with the heading "Dealing with underscores in PIDs or datastream IDs" had more detail.

theMusician commented 5 years ago

Hiya @mjordan. We are happy to give this a go. I have messaged the librarians that do the datastream work. Once I have a time aligned with them I will swap branches and we can get it tested. Thanks for continuing to work on this.

mjordan commented 5 years ago

@theMusician please do, but @bgilling has already given the branch a thorough test over at #33, so I'm happy to merge now. Your call.

theMusician commented 5 years ago

No issues on our end. Thanks for the better fix.

mjordan commented 5 years ago

Super, thanks very much.

theMusician commented 5 years ago

image001

Drats, we tried another test and it seems to be treating wwu as the target pid.

Here is what we did:

We used an Islandora Datastream CRUD command to fetch a FULL_TEXT datastream from a PDF object in MABEL

I used CRUD again to push that same FULL_TEXT datastream back to its original object

Here’s the drush command I used: drush -v -u 1 islandora_datastream_crud_push_datastreams --datastreams_source_directory=/tmp/asbod_tr/ --datas treams_mimetype=text/plain --datastreams_label=FULL_TEXT

The file I uploaded was named: wwu_24666_FULL_TEXT.txt

What should have happened: The FULL_TEXT datastream that I pushed to the object should have replaced the existing FULL_TEXT datastream with a new version.

What happened instead: CRUD treated the file as a new datastream with the ID ‘FULL’ instead of reading it as ‘FULL_TEXT’

theMusician commented 5 years ago

Gahh... didn't see the new instructions in the Readme, which you clearly pointed out.

That did work, though it created three copies of the datastream with the same timestamp.

unknown-1

mjordan commented 5 years ago

@theMusician I can't replicate the multiple datastreams behavior. Can you try again and confirm?

mjordan commented 5 years ago

@theMusician Since I can't replicate the duplicate versions, I'm going to merge this change into 7.x so it doesn't get too stale and close this issue and #33. However, feel free to reopen if you can replicate that behavior.

mjordan commented 5 years ago

Merged with 60ed72125023fd27adf8bb8f2df94f20d1cce84b.