Problem with "link" method
mmdm95 opened this issue · 0 comments
mmdm95 commented
Hi,
I found a problem with link method, it has below functionality:
function link(path) {
return "/" + root + "/" + clean(path);
}
But it cause problem through using it.
For example:
// when I use it as below
link('/')
// result: //
// OR ---
link('/login')
// result: //login
// This happens because root may have been empty string
const router = new Navigo('/'); // root: '/' and it'll be cleared --> root: empty string
I think it must trim below part for slashes:
// use REGEXP to trim slashes
clean(root + "/" + clean(path));
// Example: if we have '/login'
// It will be:
// (clean('/login')) --> login
// then --> '/' + 'login' --> '/login'
// and problem will solve I guess
Thanks for your time