Skip to content

File name is interpreted as regular expression #49

@mamtasuri-coraid

Description

@mamtasuri-coraid

Canned is working great for simple file names such as v1/info/index.get.json. But when we have complicated names that we are testing from influxdb, it's giving an error saying that can't interpret as regular expression. Please suggest!

curl -sLGw "\n%{http_code} %{url_effective}\n" "http://localhost:17022/db/EtherCloudStats/series?u=root&p=root&q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null)"

Message from canned:
request: get /db/EtherCloudStats/series?u=root&p=root&q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null)
/home/msuri/ec/testeng/data/mock/canned/canned.js:29
new RegExp(fname + "(?=." + queryString.split("&").join(")(?=.") + ").+"
^
SyntaxError: Invalid regular expression: /(?=._u=root)(?=._p=root)(?=.*q=select+mean(value)+from+%22Coraid.1Controller.ZFS.VOps-3008.gauge.wlat%22+where+time+%3E++now()+-+86400000000u+and+time+%3C+now()+-+0u+group+by+time(240000000u)+fill(null)).+get/: Nothing to repeat
at new RegExp ()
at matchFileWithExactQuery (/home/msuri/ec/testeng/data/mock/canned/canned.js:29:5)
at getFileFromRequest (/home/msuri/ec/testeng/data/mock/canned/canned.js:51:13)
at Canned._responseForFile (/home/msuri/ec/testeng/data/mock/canned/canned.js:123:20)
at /home/msuri/ec/testeng/data/mock/canned/canned.js:168:10
at Object.oncomplete (fs.js:107:15)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions