mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
WebUI: add linting for regular expressions
And applies to following suggestions: * Use case-insensitive flag `i` * Use `\w` for matching characters * Sort the regex flags
This commit is contained in:
@@ -143,7 +143,7 @@ window.qBittorrent.Misc = (function() {
|
||||
* JS counterpart of the function in src/misc.cpp
|
||||
*/
|
||||
const parseHtmlLinks = function(text) {
|
||||
const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
|
||||
const exp = /(\b(https?|ftp|file):\/\/[-\w+&@#/%?=~|!:,.;]*[-\w+&@#/%=~|])/gi;
|
||||
return text.replace(exp, "<a target='_blank' rel='noopener noreferrer' href='$1'>$1</a>");
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user