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

Fixes for broken image messages #2585

Merged
merged 1 commit into from
Nov 7, 2024
Merged
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
9 changes: 7 additions & 2 deletions concordia/static/js/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
If provided, uniqueId will be used to remove any existing elements which
have that ID, allowing old messages to be replaced automatically.
*/
var $messages = $('#messages');
let $messages = $('#messages');
$messages.removeAttr('hidden');

var $newMessage = $messages
let $newMessage = $messages
.find('#message-template .alert')
.clone()
.removeAttr('hidden')
Expand All @@ -76,7 +76,12 @@

// Add a span to the message to ensure justified
// styles don't end up splitting the text
// message might be a Text node, so we need to get
// the actual text if so
if (message instanceof Text) {
message = message.textContent;
}
$newMessage.prepend('<span>' + message + '</span>');

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium

DOM text
is reinterpreted as HTML without escaping meta-characters.

$messages.append($newMessage);

Expand Down
2 changes: 1 addition & 1 deletion concordia/static/js/src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ seadragonViewer.addHandler('open-failed', function () {
let contactUs =
'<strong><a class="alert-link" href="' +
viewerData.contactUrl +
'">contact us</a></strong>';
'" target="_blank">Contact us</a></strong>';
displayHtmlMessage(
'error',
'Unable to display image - ' + contactUs,
Expand Down
2 changes: 1 addition & 1 deletion concordia/templates/transcriptions/asset_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<script id="viewer-data"
data-prefix-url="{% static 'openseadragon/build/openseadragon/images/' %}"
data-tile-source-url="{% asset_media_url asset %}?canvas"
data-contact-url="{% url 'contact' %}"
data-contact-url="https://ask.loc.gov/crowd"
></script>

<script type="importmap">
Expand Down