mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-02-21 07:29:37 +01:00
fix: 🐛 incorrect logo url with slash at the end of url_prefix
This commit is contained in:
parent
dce43c0682
commit
859eccb1be
@ -10,6 +10,7 @@ const _ = require('lodash');
|
||||
const env = require('../../config/env');
|
||||
const fs = require('fs');
|
||||
const template = fs.readFileSync(`${env.DIST_PATH}/index.html`).toString();
|
||||
const spliceURL = require('../../utils/string').spliceURL;
|
||||
|
||||
module.exports = function(config, auth, storage) {
|
||||
Search.configureStorage(storage);
|
||||
@ -35,7 +36,7 @@ module.exports = function(config, auth, storage) {
|
||||
router.get('/-/verdaccio/logo', function(req, res) {
|
||||
const installPath = _.get(config, 'url_prefix', '');
|
||||
|
||||
res.send(_.get(config, 'web.logo') || `${installPath}/-/static/logo.png`);
|
||||
res.send(_.get(config, 'web.logo') || spliceURL(installPath, '/-/static/logo.png'));
|
||||
});
|
||||
|
||||
router.get('/', function(req, res) {
|
||||
|
3
src/utils/string.js
Normal file
3
src/utils/string.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports.spliceURL = function spliceURL() {
|
||||
return Array.from(arguments).reduce((lastResult, current) => lastResult + current).replace(/([^:])(\/)+(.)/g, `$1/$3`);
|
||||
};
|
Loading…
Reference in New Issue
Block a user