sanitize html in few more places

auto-update
Zlatin Balevsky 2021-09-14 21:11:55 +01:00
parent 559dd76fc7
commit 8fb8bba5f8
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 6 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class CertificateControlView {
scrollPane { scrollPane {
certsTable = table(autoCreateRowSorter : true, rowHeight : rowHeight) { certsTable = table(autoCreateRowSorter : true, rowHeight : rowHeight) {
tableModel(list : model.certificates) { tableModel(list : model.certificates) {
closureColumn(header : trans("FILE_NAME"), type : String, read : {it.name.name}) closureColumn(header : trans("FILE_NAME"), type : String, read : {HTMLSanitizer.sanitize(it.name.name)})
closureColumn(header : trans("HASH"), type : String, read : {Base64.encode(it.infoHash.getRoot())}) closureColumn(header : trans("HASH"), type : String, read : {Base64.encode(it.infoHash.getRoot())})
closureColumn(header : trans("COMMENT"), preferredWidth : 20, type : Boolean, read : {it.comment != null}) closureColumn(header : trans("COMMENT"), preferredWidth : 20, type : Boolean, read : {it.comment != null})
closureColumn(header : trans("TIMESTAMP"), type : Long, read : { it.timestamp }) closureColumn(header : trans("TIMESTAMP"), type : Long, read : { it.timestamp })

View File

@ -401,7 +401,7 @@ class MainFrameView {
scrollPane (constraints : BorderLayout.CENTER) { scrollPane (constraints : BorderLayout.CENTER) {
table(id : "uploads-table", autoCreateRowSorter: true, rowHeight : rowHeight) { table(id : "uploads-table", autoCreateRowSorter: true, rowHeight : rowHeight) {
tableModel(list : model.uploads) { tableModel(list : model.uploads) {
closureColumn(header : trans("NAME"), type : String, read : {row -> row.uploader.getName() }) closureColumn(header : trans("NAME"), type : String, read : {row -> HTMLSanitizer.sanitize(row.uploader.getName()) })
closureColumn(header : trans("PROGRESS"), type : String, read : { row -> closureColumn(header : trans("PROGRESS"), type : String, read : { row ->
int percent = row.uploader.getProgress() int percent = row.uploader.getProgress()
trans("PERCENT_OF_PIECE", percent) trans("PERCENT_OF_PIECE", percent)

View File

@ -2,8 +2,10 @@ package com.muwire.gui
class InterimTreeNode { class InterimTreeNode {
private final File file private final File file
private final String toString
InterimTreeNode(File file) { InterimTreeNode(File file) {
this.file = file this.file = file
this.toString = HTMLSanitizer.sanitize(file.getName())
} }
public File getFile() { public File getFile() {
@ -17,6 +19,6 @@ class InterimTreeNode {
} }
public String toString() { public String toString() {
file.getName() toString
} }
} }

View File

@ -37,7 +37,7 @@ class SharedTreeRenderer extends DefaultTreeCellRenderer {
SizeFormatter.format(length,sb) SizeFormatter.format(length,sb)
sb.append(bShort) sb.append(bShort)
setText("$name (${sb.toString()})") setText(HTMLSanitizer.sanitize("$name (${sb.toString()})"))
setEnabled(true) setEnabled(true)
if (sf.comment != null) { if (sf.comment != null) {
setIcon(commentIcon) setIcon(commentIcon)