projects
/
oweals
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bd45344
)
luci-base: cbi.js: handle undefined arguments in formatting
author
Jo-Philipp Wich
<jo@mein.io>
Thu, 4 Aug 2016 09:45:04 +0000
(11:45 +0200)
committer
Jo-Philipp Wich
<jo@mein.io>
Thu, 4 Aug 2016 09:45:30 +0000
(11:45 +0200)
Fix the JavaScript String.format() to not trigger an exception if the argument
for an escaped format like %h or %q is undefined.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/cbi.js
patch
|
blob
|
history
diff --git
a/modules/luci-base/htdocs/luci-static/resources/cbi.js
b/modules/luci-base/htdocs/luci-static/resources/cbi.js
index b285ee26ccf1b656f9cd4648b38214d393473e14..5790e303dd3e41128179af509d5666d854334463 100644
(file)
--- a/
modules/luci-base/htdocs/luci-static/resources/cbi.js
+++ b/
modules/luci-base/htdocs/luci-static/resources/cbi.js
@@
-1300,6
+1300,9
@@
String.prototype.format = function()
var quot_esc = [/"/g, '"', /'/g, '''];
function esc(s, r) {
+ if (typeof(s) !== 'string' && !(s instanceof String))
+ return '';
+
for( var i = 0; i < r.length; i += 2 )
s = s.replace(r[i], r[i+1]);
return s;