Giter VIP home page Giter VIP logo

Comments (6)

joeldev avatar joeldev commented on May 22, 2024 1

Just pushed version 2.0.3 with this fix included. Feel free to file more issues if anything comes up!

from jlroutes.

joeldev avatar joeldev commented on May 22, 2024

Can I see an example of what your addRoute call might look like for these? Just trying to fully wrap my head around what you're trying to do. I think I might just add a way to configure this parsing behavior, as it seems to be one way or the other depending on the product and needs.

from jlroutes.

runmad avatar runmad commented on May 22, 2024

Hi @joeldev, thanks for replying.

Here's few examples:

[[JLRoutes globalRoutes] addRoute:@"/sign_in" handler:^BOOL(NSDictionary *parameters) {}];
[[JLRoutes globalRoutes] addRoute:@"/market/:marketId" handler:^BOOL(NSDictionary *parameters) {}];

And calling [JLRoutes routeURL:url]; or [[JLRoutes globalRoutes] routeURL:url]; doesn't work - it fails in the part of the method above as it's adding the host to the path as mentioned in my original post.

We have several domains that the app can handle, so all we care about is the path component of the URL: /sign_in, /market/:marketId, etc. not www.domain.com/sign_in.

Previously we used:

[JLRoutes addRoute:@"/sign_in" handler:^BOOL(NSDictionary *parameters) {}]; which has been deprecated and [JLRoutes routeURL:url]; and this worked perfectly (in 1.6.3)

Worth mentioning, it works fine if the URL is something like myapp://sign_in.

from jlroutes.

joeldev avatar joeldev commented on May 22, 2024

Ah, I see why this broke between 1.6.3 and now. This is what the code used to look like:

if ([URL.host rangeOfString:@"."].location == NSNotFound && ![URL.host isEqualToString:@"localhost"]) {
    // For backward compatibility, handle scheme://path/to/resource as if path was part of the path
    pathComponents = [@[URL.host] arrayByAddingObjectsFromArray:pathComponents];
}

So it appears to have been taking into account if there was a period in the host, but that was dropped. I don't think that was intentional. Working on a fix and tests now.

from jlroutes.

runmad avatar runmad commented on May 22, 2024

Awesome, thanks so much!

from jlroutes.

runmad avatar runmad commented on May 22, 2024

Works perfectly, thanks very much for the speedy release!

from jlroutes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.