Handle basepath issue with missing slash
parent
573cdff30a
commit
7bcffde792
|
@ -47,8 +47,9 @@ func NewMux(opts MuxOpts, service Service) http.Handler {
|
|||
})
|
||||
|
||||
if opts.Basepath != "" {
|
||||
basePath := fmt.Sprintf("%s/", opts.Basepath)
|
||||
// Prefix any URLs found in the React assets with any configured basepath
|
||||
assets = NewDefaultURLPrefixer(opts.Basepath, assets, opts.Logger)
|
||||
assets = NewDefaultURLPrefixer(basePath, assets, opts.Logger)
|
||||
}
|
||||
|
||||
// Compress the assets with gzip if an accepted encoding
|
||||
|
|
|
@ -6,7 +6,12 @@ export const getBasepath = () => {
|
|||
return ''
|
||||
}
|
||||
|
||||
return rootNode.getAttribute('data-basepath') || ''
|
||||
let basepath = rootNode.getAttribute('data-basepath') || ''
|
||||
if (basepath !== '') {
|
||||
basepath = basepath.slice(0, basepath.length - 1)
|
||||
}
|
||||
|
||||
return basepath
|
||||
}
|
||||
|
||||
export const stripPrefix = (pathname, basepath = getBasepath()) => {
|
||||
|
|
Loading…
Reference in New Issue