digitalascetic / iron-router-i18n

Meteor iron router support for i18n
MIT License
36 stars 5 forks source link

Problem with excluded urls when reloading page #82

Open patte opened 8 years ago

patte commented 8 years ago

I'm encountering a strange behaviour related to excluded paths on the client. Everything works fine as long as the app is loaded and I'm traveling through routes. But when I reload the page (manually or via hot code push) excluded routes that worked perfectly before, suddenly get language-prefixed and everything blows up ;) meaning I get redirected to routes that don't exist.

Here's my config

Router.configure
  i18n:
    exclude:
      adminPaths: '^\/admin'
      blogPaths: '^\/blog'
    server:
      exclude: 
        sitemap: '^\/sitemap\.xml'

I stepped through the code and I discovered that when I reload, _i18n.isPathExcluded first gets hit with all my routes and then with the active route, but in absolute form, in contrast to when I'm browsing like this, the url comes in relative form.

screen shot 2016-02-06 at 02 04 58 screen shot 2016-02-06 at 02 05 31

so far so good. But when I reload this happens:

screen shot 2016-02-06 at 02 06 07

May I'm doing something wrong or can I help further to resolve the problem?