GithubHelp home page GithubHelp logo

iron-url's People

Contributors

andylash avatar chrisbutler avatar cmather avatar dburles avatar dweldon avatar paralin avatar tmeasday avatar wallslide avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

iron-url's Issues

Url.parse strips ? from :_id? type route params

Url.parse('/route/:_id/:slug?') don't handle the '?' part well,

it strips the '?' part and handle everything after it as query string or something.

Url.parse('/route/:_id?/:slug?') returns {..., pathname: '/route/:_id', path: '/route/:_id?/:slug?',...}
and pathname is used by normalize and other stuff that breaks optional params routing in iron:router.

I took a look at the code but I lack the in-depth knowledge to actually try and make a PR that might work with this and not skrew up the support for the old school hash frag support. Maybe I'm overthinking this but you know...

edit: Mixed up pathname and path, it's fixed now. The information is correct now

Url.resolve doesn't support wildcard character in parameter values

I don't use wildcard in routes; simply define a route

Router.route("/user/:id?", {
    name: "userInfo",
    template: "...",
    layoutTemplate: "...",
});

and use

Router.routes.userInfo.path({
    id: Meteor.user().username
});

Then if I have the user name a*a, Router.routes.userInfo.path throws an exception You are trying to access a wild card parameter at index 0 but but the value of params at that index is undefined

Stack trace:

  1. route.js/path
  2. handler.js/resolve
  3. url.js/resole

Any wildcard in a params will result in this.

Padding is removed from base64 encoded values.

I believe this line is causing the issue, which is basically that the base64 padding at the end of a string (==) is being removed from the value.

So (using bogus base64 value for point), you might expect ?data=DgxfQ== to produce {data: 'DgxfQ=='}, but instead it produces {data: 'DgxfQ'}.

Instead of pair.split('='), perhaps something like this would work more reliably, though I suspect it's a bit more expensive:

idx = pair.indexOf('=');
key = pair.substr(0, idx);
value = pair.substr(idx+1);

I'd hoped pair.split('=', 2) would do the trick, but that truncates the trailing == as well.

...has anyone thanked you for your work recently? Either way, many thanks ;)

Handle arrays in parameters

The plan is to use rail's style, and have URLs of the form

/path?foo[]=a&foo[]=b

To end up with this.params.foo === ['a', 'b'].

The alternative is /path?foo=a&foo=b. But the downside there is you can't do a single element array, which is sucky. Either way you can't do a zero-element array. Not sure if there's anything principled that can be done about this.

Let me know if you want me to go ahead with this.

Authorization gets lowercased

URLs with authorization present get lowercased, causing passwords to become corrupted for case-sensitive systems.

Undefined being added to URL parameter value

My route looks like this:

Router.map(function() {
  this.route('ship.parcel.addressChooser', {path: '/ship/choose-address/:_id',});
});

And I call Router.go() like this:

Router.go('ship.parcel.addressChooser', {_id: parcelId});

The parcelId is a string that equals PP-dev-KrdGbz

The resulting url that I get sent to ends up being this: http://localhost:3002/ship/choose-address/undefinedPP-dev-KrdGbz

You can see that there is an extra undefined in that URL. When going deep into my debugger, I found the following:

image

Basically, the parameter format is undefined, which then gets appended as a string to the final path. I'm not sure what the purpose of that match parameter is, but it seems like you could just do the same thing that you are doing with the slash match parameter here right below that line like this: format = format || '';

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.