mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-10 07:22:47 -07:00
WebUI: fix escaping of HTML special characters
JS code for torrent general properties, files, peers, trackers inconsistently escaped HTML special characters, then the dynamicTable inconsistently escaped again and then the value was set to HTML element text or html properties. To fix this mess, don't escape any property values in the prop-*.js files. Instead, make dynamicTable set HTML element text instead of html property by default. This behavior can be overridden by setting a custom updateTd function on the respective column, if needed. This is where the HTML escaping should be done. Also reordered existing updateTd functions to match column order, changed custom updateTd functions from setting html to text property wherever possible, removed custom updateTd functions that turned out to be redundant.
This commit is contained in:
parent
72e511e3c4
commit
ecc3ff3ca4
5 changed files with 124 additions and 157 deletions
|
@ -393,15 +393,14 @@ window.qBittorrent.PropFiles = (function() {
|
|||
if ((progress === 100) && (file.progress < 1))
|
||||
progress = 99.9;
|
||||
|
||||
const name = window.qBittorrent.Misc.escapeHtml(file.name);
|
||||
const ignore = (file.priority === FilePriority.Ignored);
|
||||
const checked = (ignore ? TriState.Unchecked : TriState.Checked);
|
||||
const remaining = (ignore ? 0 : (file.size * (1.0 - file.progress)));
|
||||
const row = {
|
||||
fileId: index,
|
||||
checked: checked,
|
||||
fileName: name,
|
||||
name: window.qBittorrent.Filesystem.fileName(name),
|
||||
fileName: file.name,
|
||||
name: window.qBittorrent.Filesystem.fileName(file.name),
|
||||
size: file.size,
|
||||
progress: progress,
|
||||
priority: normalizePriority(file.priority),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue