Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes control characters in the input/output of content #319

Open
wants to merge 1 commit into
base: 7.x
Choose a base branch
from
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
13 changes: 11 additions & 2 deletions includes/coins.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,17 @@ class Coins {
$xml = new SimpleXMLElement($xmlstr);
$xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');

$this->mods = $xml;


try {
$this->mods = islandora_sanitize_input_for_valid_xml($xml);
}
catch (Exception $e) {
watchdog('islandora_scholar', 'The upload of "@dsid" of "@pid" could not be parsed as XML.', array(
'@dsid' => 'MODS',
'@pid' => $object->id,
), WATCHDOG_WARNING, l(t("manage object"), "islandora/object/{$object->id}/manage/datastreams"));
return " ";
}
$authors = array();
$contributors = array();

Expand Down
11 changes: 10 additions & 1 deletion includes/upload.tab.inc
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ function islandora_scholar_modify_form(array $form, array &$form_state, Abstract

$mods_doc = new DOMDocument();
$mods_doc->loadXML($mods_str);
$mods_xpath = new DOMXPath($mods_doc);
try {
$mods_xpath = new DOMXPath(islandora_sanitize_input_for_valid_xml($mods_doc));
}
catch (Exception $e) {
watchdog('islandora_scholar', 'The upload of "@dsid" of "@pid" could not be parsed as XML.', array(
'@dsid' => 'MODS',
'@pid' => $object->id,
), WATCHDOG_WARNING, l(t("manage object"), "islandora/object/{$object->id}/manage/datastreams"));
return " ";
}
$mods_xpath->registerNamespace('m', 'http://www.loc.gov/mods/v3');
$usage = t('No usage statement');
$mods_usages = $mods_xpath->query('//m:mods/m:accessCondition[@type="use and reproduction"]');
Expand Down
2 changes: 1 addition & 1 deletion modules/citeproc/includes/converter.inc
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function convert_mods_to_citeproc_jsons($mods_in) {
}
else {
try {
$mods = simplexml_load_string($mods_in);
$mods = simplexml_load_string(islandora_sanitize_input_for_valid_xml($mods_in));
}
catch (Exception $e) {
watchdog('citeproc', 'Got exception while parsing. Message: !msg Errors: !error', array(
Expand Down