now trailing ':' are trimmed by path.normalize(..)

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-09-20 11:41:38 +03:00
parent f5d2b47d00
commit f64e617ccb
2 changed files with 14 additions and 10 deletions

View File

@ -124,13 +124,14 @@ object.Constructor('BasePage', {
}, },
resolvePathVars: function(path, context={}){ resolvePathVars: function(path, context={}){
var that = this var that = this
return Object.entries(this.path_vars) return pwpath.normalize(
.reduce(function(res, [key, func]){ Object.entries(this.path_vars)
return res .reduce(function(res, [key, func]){
.replace( return res
new RegExp('(\\${'+key+'}|\\$'+key+')', 'g'), .replace(
func.call(that, context)) new RegExp('(\\${'+key+'}|\\$'+key+')', 'g'),
}, path) }, func.call(that, context))
}, path)) },
// page location... // page location...
// //
@ -914,7 +915,6 @@ object.Constructor('Page', BasePage, {
// XXX DEPENDS_PATTERN // XXX DEPENDS_PATTERN
depends.add(src) depends.add(src)
handler = handler handler = handler
?? async function(src, state){ ?? async function(src, state){
return isolated ? return isolated ?
@ -1036,7 +1036,6 @@ object.Constructor('Page', BasePage, {
// XXX DEPENDS_PATTERN // XXX DEPENDS_PATTERN
depends.add(src) depends.add(src)
var pages = src ? var pages = src ?
(!expandactions (!expandactions
&& await this.get(src).type == 'action' ? && await this.get(src).type == 'action' ?
@ -1295,7 +1294,6 @@ object.Constructor('Page', BasePage, {
// XXX DEPENDS_PATTERN // XXX DEPENDS_PATTERN
depends.add(src) depends.add(src)
join = _getBlock('join') join = _getBlock('join')
?? join ?? join
join = join join = join

View File

@ -123,6 +123,12 @@ module = {
// clear the trailing '/'... // clear the trailing '/'...
path.at(-1) == '' path.at(-1) == ''
&& path.pop() && path.pop()
// trim trailing ':'...
path.at(-1)
&& path.at(-1).endsWith(':')
&& (path.push(
path.pop()
.replace(/:*$/, '')))
/*/ XXX NORMCACHE... /*/ XXX NORMCACHE...
var res = format == 'string' ? var res = format == 'string' ?
// special case: root -> keep '/' // special case: root -> keep '/'