aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPeter Wu2014-08-10 11:28:07 +0200
committerPim van den Berg2014-08-10 14:35:48 +0200
commit8c181dc1e7fc07bb9b61e8465ba04e9d4c5b7838 (patch)
tree7c15d6c71611925296e5a20e0679feb8c5826c1b
parentAdd README file (diff)
downloadapt-panopticon_cgp-8c181dc1e7fc07bb9b61e8465ba04e9d4c5b7838.zip
apt-panopticon_cgp-8c181dc1e7fc07bb9b61e8465ba04e9d4c5b7838.tar.gz
apt-panopticon_cgp-8c181dc1e7fc07bb9b61e8465ba04e9d4c5b7838.tar.bz2
apt-panopticon_cgp-8c181dc1e7fc07bb9b61e8465ba04e9d4c5b7838.tar.xz
jsrrdgraph: Fix parsing of rrdfiles containing escapes
This fixes parsing of URLs such as 'rrd.php?path=some%3Ffile.rrd', and if people really insist, paths such as 'C:\bar.rrd' (must be written as 'C\:\\bar.rrd', add additional escapes for Javascript strings if needed).
-rw-r--r--js/RrdCmdLine.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/js/RrdCmdLine.js b/js/RrdCmdLine.js
index a2be92e..c222498 100644
--- a/js/RrdCmdLine.js
+++ b/js/RrdCmdLine.js
@@ -389,11 +389,13 @@ RrdCmdLine.prototype = {
389 // DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>] 389 // DEF:<vname>=<rrdfile>:<ds-name>:<CF>[:step=<step>][:start=<time>][:end=<time>][:reduce=<CF>]
390 parse_def: function (line) 390 parse_def: function (line)
391 { 391 {
392 var args = line.split(/:/); 392 // Every character (except ':' and '\') are allowed within a value. The
393 var n=1; 393 // two exceptions must be escaped with a slash.
394 var vnames = args[n++].split('='); 394 var args = line.match(/(\\.|[^:\\])+/g);
395 var vname = vnames[0]; 395 var n = 1;
396 var rrdfile = vnames[1]; 396 var vnames = args[n++];
397 var vname = vnames.substr(0, vnames.indexOf("="));
398 var rrdfile = vnames.substr(vname.length + 1).replace(/\\(.)/g, "$1");
397 var name = args[n++]; 399 var name = args[n++];
398 var cf = args[n++]; 400 var cf = args[n++];
399 var step, reduce, start, end; 401 var step, reduce, start, end;