[ 
https://issues.apache.org/jira/browse/STORM-439?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14110954#comment-14110954
 ] 

ASF GitHub Bot commented on STORM-439:
--------------------------------------

Github user Parth-Brahmbhatt commented on the pull request:

    https://github.com/apache/incubator-storm/pull/242#issuecomment-53454343
  
    Our mustache templates have anchor tags where we just do the following 
    
    <a href="/topology.html?id={{id}}">{{name}}</a>
    
    As you already mentioned mustache does the escaping but not encoding. So 
the above results in unencoded url which results in the bug that we are trying 
to fix.  I have tried reading through mustache docs and googling around to see 
if there is any way to invoke javascript functions like encodeURIComponent as 
part of mustache template and I haven't had much luck. The only suggestion was 
to send lambda constructs as response from server side which is no different 
then just sending encoded components. There are 3 other alternatives that I 
could think of:
    
    1) Encode and server side, which is what we are doing right now.
    2)  Process the json on browser side before rendering using mustache. 
Pretty much the same thing as above but the client will have to loop through 
json response twice once to encode and once to render using mustache.
    3) Use a more powerful library than mustache or replace all anchor tags 
with some div's with onclick being handled by jquery. 
    
    The easiest of 3 was the 1st option so I went with it. That said, I am not 
sure what are the general best practices so I don't mind changing it to option 
2 or 3 or any other idea that someone else can propose.
    
    The URL decoding happens as part of 
https://github.com/weavejester/clout/blob/master/src/clout/core.clj#L96
    So the decoding on our side results in a bug. 
    
    test%5Ftest -> browser sends encoded test%255Ftest -> clout decodes to 
test%5Ftest -> our code decodes again and tries to look for test_test topology 
which is not alive. 
    
    I can remove the purl.js but I am not sure which library is actually better 
so if anyone has any comparison points please let me know. I am planning to fix 
the purl.js bug so if the change request gets approved we can always revert 
back to it. 
    



> UI unable to view topologies with percent encoded values in id
> --------------------------------------------------------------
>
>                 Key: STORM-439
>                 URL: https://issues.apache.org/jira/browse/STORM-439
>             Project: Apache Storm (Incubating)
>          Issue Type: Bug
>    Affects Versions: 0.9.2-incubating
>            Reporter: Bryan Baugher
>            Assignee: Parth Brahmbhatt
>
> We recently upgraded to 0.9.2 from 0.8.2 or so. One of our topologies had a 
> percent encoded value in the id 'destination%F5backfill' (or interpreted 
> 'destination_backfill'). The UI is unable to view this topology giving us the 
> error,
> {code}
> NotAliveException(msg:destination_backfill-2-1407261676)
> at 
> backtype.storm.generated.Nimbus$getTopologyInfo_result.read(Nimbus.java:11347)
>       at org.apache.thrift7.TServiceClient.receiveBase(TServiceClient.java:78)
>       at 
> backtype.storm.generated.Nimbus$Client.recv_getTopologyInfo(Nimbus.java:491)
>       at 
> backtype.storm.generated.Nimbus$Client.getTopologyInfo(Nimbus.java:478)
>       at backtype.storm.ui.core$topology_page.invoke(core.clj:587)
>       at backtype.storm.ui.core$fn__8229.invoke(core.clj:796)
>       at compojure.core$make_route$fn__3365.invoke(core.clj:93)
>       at compojure.core$if_route$fn__3353.invoke(core.clj:39)
>       at compojure.core$if_method$fn__3346.invoke(core.clj:24)
>       at compojure.core$routing$fn__3371.invoke(core.clj:106)
>       at clojure.core$some.invoke(core.clj:2443)
>       at compojure.core$routing.doInvoke(core.clj:106)
>       at clojure.lang.RestFn.applyTo(RestFn.java:139)
>       at clojure.core$apply.invoke(core.clj:619)
>       at compojure.core$routes$fn__3375.invoke(core.clj:111)
>       at ring.middleware.reload$wrap_reload$fn__7540.invoke(reload.clj:14)
>       at backtype.storm.ui.core$catch_errors$fn__8268.invoke(core.clj:858)
>       at 
> ring.middleware.keyword_params$wrap_keyword_params$fn__4029.invoke(keyword_params.clj:27)
>       at 
> ring.middleware.nested_params$wrap_nested_params$fn__4068.invoke(nested_params.clj:65)
>       at ring.middleware.params$wrap_params$fn__4001.invoke(params.clj:55)
>       at 
> ring.middleware.multipart_params$wrap_multipart_params$fn__4096.invoke(multipart_params.clj:103)
>       at ring.middleware.flash$wrap_flash$fn__4277.invoke(flash.clj:14)
>       at ring.middleware.session$wrap_session$fn__4266.invoke(session.clj:43)
>       at ring.middleware.cookies$wrap_cookies$fn__4197.invoke(cookies.clj:160)
>       at ring.adapter.jetty$proxy_handler$fn__7179.invoke(jetty.clj:16)
>       at 
> ring.adapter.jetty.proxy$org.mortbay.jetty.handler.AbstractHandler$0.handle(Unknown
>  Source)
>       at 
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>       at org.mortbay.jetty.Server.handle(Server.java:326)
>       at 
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>       at 
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
>       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
>       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>       at 
> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
>       at 
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
> {code}
> So it seems the UI is translating the percent encoded value which causes this 
> issue. We shouldn't be putting these values in our topologies id in the first 
> place but thought I would log this to see if you wanted to try to limit what 
> characters are allowed in a topology id.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to