Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/export.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function islandora_datastreams_io_export_form_submit(array $form, array &$form_s
}
else {
$bad_pids = $good_pids = array();
$pids_arr = explode("\n", $pids);
$pids_arr = explode(PHP_EOL, $pids);
foreach ($pids_arr as $pid) {
$pid = str_replace("\\r", "", trim($pid));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This raises questions. Is this really a replace of literal '\r' , or is this a replace of CRs unhandled by the LF explode?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the strings are harvested internally. We could explode on a regex if we didn't know where the source files were coming from.

Copy link
Contributor

@wgilling wgilling Aug 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The input of PID values would be whatever the user entered in the textarea and I am not an expert on all of the operating systems' or text editors' copy/paste formats -- but did have to put this in there to clean up the $pid value per line because one editor did not have the \r at all and another one did. I would think that the changes would certainly not break anything - possibly the str_replace on line 250 is harmlessly redundant.

$islandora_object = islandora_object_load($pid);
Expand Down
2 changes: 1 addition & 1 deletion includes/relationships.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ function islandora_datastreams_io_relationships_form_submit(array $form, array &
if ($pids) {
$bad_pids = $good_pids = $relationship_skipped = array();
$updated_count = 0;
$pids_arr = explode("\n", $pids);
$pids_arr = explode(PHP_EOL, $pids);
$operation = $form_state['values']['operation'];
$namespace = $form_state['values']['namespace'];
$predicate = $form_state['values']['predicate'];
Expand Down
2 changes: 1 addition & 1 deletion includes/transform.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function islandora_datastreams_io_transform_form_submit(array $form, array &$for
$pids = islandora_datastreams_io_pids_namespace_accessible($pids);
$bad_pids = $skipped = array();
$updated_count = 0;
$pids_arr = explode("\r\n", $pids);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting use case. Why was this assuming CRLF when others were assuming LFs?

$pids_arr = explode(PHP_EOL, $pids);

$transform = '';
// ONLY use the $_FILE if the $selected_dsid does not contain "*"
Expand Down
2 changes: 1 addition & 1 deletion includes/update_label.form.inc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function islandora_datastreams_io_update_label_form_submit(array $form, array &$
if ($pids) {
$bad_pids = $skipped = array();
$updated_count = 0;
$pids_arr = explode("\r\n", $pids);
$pids_arr = explode(PHP_EOL, $pids);

foreach ($pids_arr as $pid) {
$pid = trim($pid);
Expand Down
6 changes: 3 additions & 3 deletions includes/utilities.inc
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function islandora_datastreams_io_mimetype_of_file($file) {
*/
function islandora_datastreams_io_pids_namespace_accessible($pids) {
module_load_include('inc', 'islandora', 'includes/utilities');
$inspect_pids = explode("\n", $pids);
$inspect_pids = explode(PHP_EOL, $pids);
$return_pids = array();
foreach ($inspect_pids as $pid) {
$pid = trim($pid);
Expand Down Expand Up @@ -408,7 +408,7 @@ function islandora_datastreams_io_pids_report_markup($form_values) {
break;
}
$temp_pids_file = file_get_contents($temp_pids_filename);
$temp_pids_file_as_arr = explode("\n", $temp_pids_file);
$temp_pids_file_as_arr = explode(PHP_EOL, $temp_pids_file);

foreach ($temp_pids_file_as_arr as $key => $pid) {
$temp_pids_file_as_arr[$key] = l($pid, 'islandora/object/' . $pid,
Expand Down Expand Up @@ -472,4 +472,4 @@ function islandora_datastreams_io_do_mods_2_dc($pid, $mods_to_dc_transform) {
return (islandora_datastreams_io_transform_datastream($islandora_object,
'MODS', 'DC', $mods_to_dc_transform));
}
}
}