Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Jul 2010
    Location
    Switzerland
    Posts
    78
    Vote Rating
    0
    fx-mike is on a distinguished road

      0  

    Default Ext.Router should handle trailing slashes

    Ext.Router should handle trailing slashes


    I just spent a lot of time debugging my app because it wouldn't redirect to one of my custom routes. In the end I found that a simple trailing slash at the end of the url broke the whole route recognizer and the router just failed silently, which could be avoided with a simple fix.

    Code:
    createMatcherRegex: function(url) {
      var paramsInMatchString = this.paramsInMatchString,
        length = paramsInMatchString.length,
        i, cond, matcher;
      
      for (i = 0; i < length; i++) {
        cond = this.conditions[paramsInMatchString[i]];
        matcher = Ext.util.Format.format("({0})", cond || "[%a-zA-Z0-9\\_\\s,]+");
         
        url = url.replace(new RegExp(paramsInMatchString[i]), matcher);
      }
      
      return new RegExp("^" + url + "/?$");
    }
    cheers
    michael

  2. #2
    Sencha - Support Team mike.estes's Avatar
    Join Date
    Mar 2011
    Location
    Redwood City, CA
    Posts
    221
    Vote Rating
    9
    mike.estes will become famous soon enough

      0  

    Default


    I've submitted this one to Engineering, thanks for reporting

  3. #3
    Sencha User
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    1
    gserio is on a distinguished road

      0  

    Question HOW to

    HOW to


    Hi Michael,
    thanks for this post, i've been struggling with the same problem.
    un fortunately i'm did'nt really grasped where to use this code: inside the router.js, or within the controller?
    Can you please provide some details on how to use this solution?
    Thanks a lot in advance
    Guido Serio

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Location
    Switzerland
    Posts
    78
    Vote Rating
    0
    fx-mike is on a distinguished road

      0  

    Default


    You need to fix this directly in the sencha touch code, so it would be best to create an override for this method.

  5. #5
    Sencha User
    Join Date
    Sep 2010
    Posts
    8
    Vote Rating
    1
    gserio is on a distinguished road

      0  

    Default @mike Got it Thanks a lot!

    @mike Got it Thanks a lot!


    Thanks for reply man,
    have a great day!

  6. #6
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    I don't think I agree with this. If the url has a trailing slash but the route is not set up to handle this, then it shouldn't match. If we start adding exceptions to this we'll be back next week when a route doesn't match a trailing question mark, or comma, or number or random letter.

    I'm going to mark this one as a won't fix for now.
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

  7. #7
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    7
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    BTW if you do specify a trailing slash then this passes:

    Code:
    describe("a url with a trailing slash", function() {
        beforeEach(function() {
            route = Ext.create('Ext.app.Route', {
                url: ':controller/:action/'
            });
        });
        
        it("should match a url with a trailing slash", function() {
            expect(route.recognize('someController/someAction/')).toBeTruthy();
        });
    });
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi