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

Merge changes from 495 to develop #5351

Merged
merged 3 commits into from
Apr 5, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ public void setPageTitle(String newTitle) {
@Override
public void setPageDescription(String newDescription) {
if (Document.get() != null) {
NodeList<com.google.gwt.dom.client.Element> tags = Document
.get()
NodeList<com.google.gwt.dom.client.Element> tags = Document.get()
.getElementsByTagName("meta");
for (int i = 0; i < tags.getLength(); i++) {
MetaElement metaTag = ((MetaElement) tags.getItem(i));
Expand Down Expand Up @@ -697,21 +696,25 @@ private static final native boolean initFilterXss() /*-{
return html;
}
},
safeAttrValue : function(tag, name, value) {
// returning nothing removes the value
if (tag === 'img' && name === 'src') {
if (value
&& (value.startsWith('data:image/') || value
.startsWith('http'))) {
return value;
}
} else {
return value;
}
}
};
$wnd.xss = new $wnd.filterXSS.FilterXSS(options);
return true;
safeAttrValue: function(tag, name, value) {
// Apply default safeAttrValue filtering:
value = $wnd.filterXSS.safeAttrValue(tag, name, value);
if (tag === 'img' && name === 'src') {
if (
!(
value &&
(value.startsWith('data:image/') || value.startsWith('http'))
)
) {
return ''
}
}
value = $wnd.filterXSS.escapeAttrValue(value)
return value
}
}
$wnd.xss = new $wnd.filterXSS.FilterXSS(options)
return true
} catch (err) {
console.error(err);
return false;
Expand Down
Loading