adopt @retardTonic fix for #22 (article title from inside a query string)

This commit is contained in:
vss-devel 2021-04-16 12:20:36 +03:00
parent 7693849cb1
commit 29cb1c45c8

View File

@ -560,8 +560,8 @@ class ArticleStub extends WikiItem {
if ( this.title )
return this.title
if ( this.url && this.url.startsWith( wiki.articleUriPrefix )) {
const urlParsed = urlconv.parse( this.url )
const subPath = urlParsed.pathname.replace( wiki.articlePath, '' ).replace( /_/g, ' ' )
const urlParsed = urlconv.parse( this.url, true )
const subPath = ( urlParsed.query[ 'title' ] || urlParsed.pathname.replace( wiki.articlePath, '' ) ).replace( /_/g, ' ' )
return decodeURIComponent( subPath )
}
return null // not a local article
@ -569,8 +569,8 @@ class ArticleStub extends WikiItem {
basePath () {
if ( this.url && this.url.startsWith( wiki.articleUriPrefix )) {
const urlParsed = urlconv.parse( this.url )
const subPath = urlParsed.pathname.replace( wiki.articlePath, '' )
const urlParsed = urlconv.parse( this.url, true )
const subPath = urlParsed.query[ 'title' ] || urlParsed.pathname.replace( wiki.articlePath, '' )
return sanitizeFN( decodeURIComponent( subPath )) + '.html'
}
return null // not a local article