Skip to content

Commit

Permalink
🐞 Fix #93, thanks to @zeearth
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-dimitru committed Jun 17, 2022
1 parent b7407b0 commit 887e833
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { page, qs } from './modules.js';
class Router {
constructor() {
this.pathRegExp = /(:[\w\(\)\\\+\*\.\?\[\]\-]+)+/g;
this.queryRegExp = /\?([^\/\r\n].*)/;
this.globals = [];
this.subscriptions = Function.prototype;
this.Renderer = new BlazeRenderer({ router: this });
Expand Down Expand Up @@ -220,11 +221,11 @@ class Router {
let queryParams = _queryParams;

if (this._routesMap[pathDef]) {
pathDef = this._routesMap[pathDef].pathDef;
pathDef = _helpers.clone(this._routesMap[pathDef].pathDef);
}

if (pathDef.includes('?')) {
const pathDefParts = pathDef.split('?');
if (this.queryRegExp.test(pathDef)) {
const pathDefParts = pathDef.split(this.queryRegExp);
pathDef = pathDefParts[0];
if (pathDefParts[1]) {
queryParams = Object.assign(this._qs.parse(pathDefParts[1]), queryParams);
Expand Down Expand Up @@ -263,7 +264,7 @@ class Router {
// but keep the root slash if it's the only one
path = path.match(/^\/{1}$/) ? path : path.replace(/\/$/, '');

// explictly asked to add a trailing slash
// explicitly asked to add a trailing slash
if (this.env.trailingSlash.get() && path[path.length - 1] !== '/') {
path += '/';
}
Expand Down

0 comments on commit 887e833

Please sign in to comment.