Skip to content

Enhance task export_csv: address Drupal config where media file url is not included in JSON serialization of media#1030

Open
jefferya wants to merge 2 commits into
mjordan:mainfrom
jefferya:jefferya/issue_1025
Open

Enhance task export_csv: address Drupal config where media file url is not included in JSON serialization of media#1030
jefferya wants to merge 2 commits into
mjordan:mainfrom
jefferya:jefferya/issue_1025

Conversation

@jefferya
Copy link
Copy Markdown
Contributor

Link to Github issue or other discussion

#1025

What does this PR do?

Enhances the export_csv task by:

  1. Add alternate method to find media file url via the entity/file; address export_csv task not finding media #1025. Some Islandora sites don't respond with a media file url property in the field_media_document, field_media_video_file, field_media_audio_file, field_media_file, etc., sections of the JSON response during a request to node/{id}/media?_format=json. Not reproducible on the Islandora Starter site.

  2. Reduces noise in the workbench log by only testing if the export directory exists during initialization instead of each time a media is downloaded thus reducing workbench.log messages indicating "Path "export_file_directory" ("export_files") already exists."

What changes were made?

Enhances the export_csv task by:

  1. If the url property is not found via node/{id}/media?_format=json API then checks the entity/file API.
  2. Reduces noise in the workbench log: creates an export validation method that runs during initialization replacing validation that run during each media download.

How to test / verify this PR?

  1. media file url
    a. should work against the islandora.sandbox.ca where media file url is part of the node/{id}/media?_format=json API
    b. should download files on the Drupal site configured such that the media file url is only exposed by the entity/file API

  2. export_csv task: workbench log output should only have one message for the following cases (not one for each media file downloaded)
    a. test config without export_file_directory
    b. test config with export_file_directory pointing to new directory
    c. test config with export_file_directory pointing to an existing directory

Sample config

task: export_csv
host: "https://cwrc.ca"
username: admin
 
content_type: islandora_object
 
input_dir: /tmp/test1/
input_csv: input.csv
 
export_csv_term_mode: name
 

export_csv_file_path: /tmp/test1/islandora_object.output.csv
 
export_file_directory: /tmp/test1/islandora_object

…ess mjordan#1025

Some Islandora sites don't respond with a url in field_media_document, field_media_video_file, field_media_audio_file, field_media_file, etc., during a request to node//media?_format=json. Not reproducible on the Islandora Starter site.
@jefferya jefferya force-pushed the jefferya/issue_1025 branch from d092505 to 4c67da5 Compare March 10, 2026 15:03
@jefferya jefferya force-pushed the jefferya/issue_1025 branch from 4c67da5 to 533d790 Compare March 10, 2026 15:49
@jefferya jefferya changed the title [WIP] enhance task export_csv: address Drupal config where media file url is not included in JSON serialization of media Enhance task export_csv: address Drupal config where media file url is not included in JSON serialization of media Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant