naming
This commit is contained in:
parent
a98b0d9a63
commit
f25ff3ec29
|
@ -402,8 +402,8 @@ class WikiItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
basePath () {
|
basePath () {
|
||||||
const urlp = urlconv.parse( this.url )
|
const purl = urlconv.parse( this.url )
|
||||||
const pathp = osPath.parse( urlp.pathname )
|
const pathp = osPath.parse( purl.pathname )
|
||||||
return sanitizeFN( decodeURIComponent( pathp.base ))
|
return sanitizeFN( decodeURIComponent( pathp.base ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,13 +727,13 @@ const urlCache = new lru({ maxSize:500 })
|
||||||
class PageComponent extends WikiItem {
|
class PageComponent extends WikiItem {
|
||||||
basePath () {
|
basePath () {
|
||||||
let name
|
let name
|
||||||
const urlp = urlconv.parse( this.url )
|
const purl = urlconv.parse( this.url )
|
||||||
if ( urlp.query && urlp.query.includes( '=' ) && this.mimeType ) {
|
if ( purl.query && purl.query.includes( '=' ) && this.mimeType ) {
|
||||||
const pathp = osPath.parse( urlp.path )
|
const pathp = osPath.parse( purl.path )
|
||||||
const ext = '.' + mimeTypes.extension( this.mimeType )
|
const ext = '.' + mimeTypes.extension( this.mimeType )
|
||||||
name = pathp.base + ext
|
name = pathp.base + ext
|
||||||
} else {
|
} else {
|
||||||
const pathp = osPath.parse( urlp.pathname )
|
const pathp = osPath.parse( purl.pathname )
|
||||||
name = pathp.name + pathp.ext.toLowerCase()
|
name = pathp.name + pathp.ext.toLowerCase()
|
||||||
}
|
}
|
||||||
return sanitizeFN( decodeURIComponent( name ))
|
return sanitizeFN( decodeURIComponent( name ))
|
||||||
|
@ -890,8 +890,8 @@ async function processSamplePage ( samplePageUrl, rmdir) {
|
||||||
http = pooledRequest( requestPromise, realUrl )
|
http = pooledRequest( requestPromise, realUrl )
|
||||||
|
|
||||||
// create download directory
|
// create download directory
|
||||||
const urlp = urlconv.parse( realUrl )
|
const purl = urlconv.parse( realUrl )
|
||||||
wiki.saveDir = sanitizeFN( urlp.hostname )
|
wiki.saveDir = sanitizeFN( purl.hostname )
|
||||||
if ( rmdir )
|
if ( rmdir )
|
||||||
await fs.remove( wiki.saveDir )
|
await fs.remove( wiki.saveDir )
|
||||||
await fs.mkdirs( wiki.saveDir )
|
await fs.mkdirs( wiki.saveDir )
|
||||||
|
|
Loading…
Reference in New Issue
Block a user