Open carlevans719 opened 8 years ago
Possibly related to 89fc983
pathWithoutBase = pathWithoutBase.replace(/^\//, '');
on line 8 of lib/router.js
resolves the issue
I'm having a similar issue - I went through and added some logging to the FlowRouter.url() function and found this output:
var completePath = this.path.apply(this, arguments);
// /wekan/b
var basePath = this._basePath || '/';
// /wekan
var pathWithoutBase = completePath.replace(new RegExp('^' + basePath), '');
// /b
return Meteor.absoluteUrl(pathWithoutBase);
// https://mydomain.net/wekan//b
The router should definitely be taking out the leading slash.
Changing line 7 of lib/router.js to
var pathWithoutBase = completePath.replace(new RegExp('^(\/)|' + basePath), '');
An argument could be added for keeping that leading slash if necessary (ie. using a hashbang).
@Serubin
var completePath = '/wekan/b';
var basePath = '/wekan';
var pathWithoutBase = completePath.replace(new RegExp('^(\/)|' + basePath), '');
Meteor.absoluteUrl(pathWithoutBase);
// "http://192.168.0.21/wekan/wekan/b"
@sunhaolin Ah, yes. Good catch, thank you.
This should fix it and account for the slash immediately following the base path if it exists.
var pathWithoutBase = completePath.replace(new RegExp('^' + basePath + '(\/)'), '');
If the ROOT_URL environment variable is set to contain a path (e.g.
http://localhost:3000/app
),FlowRouter.url()
inserts an extra forward slash in the return value.Repro: https://github.com/carlevans719/flow-router-root-url-repro