Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
fix(plugins): creates serve from url properly
Browse files Browse the repository at this point in the history
  • Loading branch information
didimitrie committed Nov 21, 2019
1 parent 3ed3256 commit 9c89d57
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,9 @@ module.exports = ( ) => {
It will load from ${pl.serveFrom + '-dupe'} instead.` )
pl.serveFrom += '-dupe'
}
//trim extra leading slash from serveFrom if necessary
const canonicalUrl = process.env.CANONICAL_URL
const lastBaseChar = canonicalUrl.charAt( canonicalUrl.length - 1 )
const firstServeFromChar = pl.serveFrom.charAt( 0 )
if ( lastBaseChar === '/' && firstServeFromChar === '/' ) {
pl.canonicalUrl = process.env.CANONICAL_URL + pl.serveFrom.slice( 1 )

}
else pl.canonicalUrl = process.env.CANONICAL_URL + pl.serveFrom
pl.canonicalUrl = new URL( pl.serveFrom, process.env.CANONICAL_URL )

} )
winston.debug( `Found ${plugins.length} plugin(s): ${plugins.map( p => p.name ).join( ', ' )}` )

Expand Down

0 comments on commit 9c89d57

Please sign in to comment.