← Back to team overview

graphite-dev team mailing list archive

[Question #183041]: problem with space escaping b/w python & ext

 

New question #183041 on Graphite:
https://answers.launchpad.net/graphite/+question/183041

I'm noticing a problem with url escaping/encoding through graphite. It has to do with python's url libs encoding spaces as pluses, and Ext's url decoding not decoding pluses to spaces.

If I create a graph with this target (via the composer):
groupByNode(carbon.agents.wfmu_local-a.creates, 1, "sumSeries")

and I then copy out the image url, it works
http://wfmu/render/?width=586&height=308&_salt=1325010004.15&target=groupByNode(carbon.agents.wfmu_local-a.creates%2C%201%2C%20%22sumSeries%22)

but if I then try to go back to the composer, it fails with a broken image/parse
http://wfmu/composer/?width=586&height=308&_salt=1325010004.15&target=groupByNode(carbon.agents.wfmu_local-a.creates%2C%201%2C%20%22sumSeries%22)

the reason is that in composer/views.py, the line:     'queryString' : request.GET.urlencode(),
ends up encoding as target=groupByNode%28carbon.agents.wfmu_local-a.creates%2C+1%2C+%22sumSeries%22%29
(spaces translated to pluses)

which is then set in the JS, and parsed in composer.js:loadURL with Ext.urlDecode, but Ext.urlDecode doesn't decode pluses into spaces, so graphite gets confused about how to parse the expression.

Ext.urlDecode('x=a+a')
Object
x: "a+a"
__proto__: Object

simplest fix seems to be changing composer/views.py:composer to     'queryString' : request.GET.urlencode().replace('+', '%20'),

thanks,
--dave

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.