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

Sanitises the the values to open #265

Closed
wants to merge 2 commits into from
Closed

Conversation

DonRichards
Copy link
Member

@DonRichards DonRichards commented Jan 16, 2020

JIRA Ticket: https://jira.lyrasis.org/browse/ISLANDORA-2498

What does this Pull Request do?

XML forms will open a MODS file with non compliant characters when you try to edit the MODS file; causing a system error and stopping the process.

This just sanitizes the XML values before they are piped to the browser.

What's new?

Just the string replace code around the XML string.

How should this be tested?

Using the test MODS in the ticket. Batch ingest it to bypass the form (avoiding the error) the try to edit. The error should show up.

Apply patch and not more error.

Additional Notes:

Screen Shot 2020-01-17 at 8 18 07 AM

Interested parties

@Islandora/7-x-1-x-committers

@bondjimbond
Copy link
Contributor

So when you open the file in the form, the bad XML is sanitized? And if you save without editing, does it save the sanitized XML?

@DonRichards
Copy link
Member Author

@bondjimbond I think so. When the text is ported to the browser this simple removes (string replace) those hidden characters. When you click save this should correct the issue and if you wanted the original you still have the previous version to revert to. I can't imagine how the \r character is specifically needed in a metadata datastream but this change won't prevent people from batch ingesting or replacing a file with a broken character. But if they do use a broken character this allows them the possibility of editing it if they'd like. Maybe a warning to the user that specific characters are going to be filter on the edit page would be a good idea?

@bondjimbond
Copy link
Contributor

Maybe a warning to the user that specific characters are going to be filter on the edit page would be a good idea?

That should address some concerns. In that warning would you be able to indicate approximately where the problem characters are? (which XML element, for example)

What about #262? Do you have a way to address @adam-vessey's comment? These two PRs should work in tandem.

@DonRichards
Copy link
Member Author

@bondjimbond honestly I completely forgot that was there. It's mostly the same with the exception of the form processor. We keep seeing this error when editing MODS in our IR and I was motivated to push a fix. That's embarrassing. The islandora_sanitize_input_for_valid_xml function does the exact same thing. What I'll do is add the warning to that PR and close this one.

@DonRichards DonRichards deleted the DonRichards-patch-2 branch January 17, 2020 16:40
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.

2 participants