mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
Merge remote-tracking branch 'origin/master' into 4.x
# Conflicts: # src/api/web/endpoint/package.js # src/lib/storage.js # src/lib/up-storage.js # src/utils/user.js
This commit is contained in:
commit
5a8d92f5f9
5 changed files with 14 additions and 10 deletions
|
@ -7,6 +7,7 @@ import _ from 'lodash';
|
|||
import { addScope, addGravatarSupport, deleteProperties, sortByName, parseReadme } from '../../../lib/utils';
|
||||
import { allow } from '../../middleware';
|
||||
import { DIST_TAGS, HEADER_TYPE, HEADERS, HTTP_STATUS } from '../../../lib/constants';
|
||||
import logger from '../../../lib/logger';
|
||||
import type { Router } from 'express';
|
||||
import type { IAuth, $ResponseExtend, $RequestExtend, $NextFunctionVer, IStorageHandler, $SidebarPackage } from '../../../../types';
|
||||
import type { Config } from '@verdaccio/types';
|
||||
|
@ -44,6 +45,7 @@ function addPackageWebApi(route: Router, storage: IStorageHandler, auth: IAuth,
|
|||
permissions.push(pkg);
|
||||
}
|
||||
} catch (err) {
|
||||
logger.logger.error({ name: pkg.name, error: err }, 'permission process for @{name} has failed: @{error}');
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -642,7 +642,7 @@ class LocalStorage implements IStorage {
|
|||
const { packages } = this.config;
|
||||
|
||||
if (packages) {
|
||||
const listPackagesConf = Object.keys(packages || {});
|
||||
const listPackagesConf = Object.keys(packages);
|
||||
|
||||
listPackagesConf.map(pkg => {
|
||||
if (packages[pkg].storage) {
|
||||
|
|
|
@ -322,17 +322,20 @@ class Storage implements IStorageHandler {
|
|||
);
|
||||
lstream.on('error', function(err) {
|
||||
self.logger.error({ err: err }, 'uplink error: @{err.message}');
|
||||
cb(), (cb = function() {});
|
||||
cb();
|
||||
cb = function() {};
|
||||
});
|
||||
lstream.on('end', function() {
|
||||
cb(), (cb = function() {});
|
||||
cb();
|
||||
cb = function() {};
|
||||
});
|
||||
|
||||
stream.abort = function() {
|
||||
if (lstream.abort) {
|
||||
lstream.abort();
|
||||
}
|
||||
cb(), (cb = function() {});
|
||||
cb();
|
||||
cb = function() {};
|
||||
};
|
||||
},
|
||||
// executed after all series
|
||||
|
@ -411,7 +414,7 @@ class Storage implements IStorageHandler {
|
|||
const upLinks = [];
|
||||
const hasToLookIntoUplinks = _.isNil(options.uplinksLook) || options.uplinksLook;
|
||||
|
||||
if (!packageInfo || packageInfo === null) {
|
||||
if (!packageInfo) {
|
||||
exists = false;
|
||||
packageInfo = generatePackageTemplate(name);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,7 @@ class ProxyStorage implements IProxy {
|
|||
let error;
|
||||
const responseLength = err ? 0 : body.length;
|
||||
// $FlowFixMe
|
||||
processBody(err, body);
|
||||
processBody();
|
||||
logActivity();
|
||||
// $FlowFixMe
|
||||
cb(err, res, body);
|
||||
|
@ -552,7 +552,7 @@ class ProxyStorage implements IProxy {
|
|||
// https://github.com/rlidwka/sinopia/issues/254
|
||||
//
|
||||
if (this.proxy === false) {
|
||||
headers['X-Forwarded-For'] = (req && req.headers['x-forwarded-for'] ? req.headers['x-forwarded-for'] + ', ' : '') + req.connection.remoteAddress;
|
||||
headers['X-Forwarded-For'] = (req.headers['x-forwarded-for'] ? req.headers['x-forwarded-for'] + ', ' : '') + req.connection.remoteAddress;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,10 @@ export const GENERIC_AVATAR: string = `
|
|||
* Generate gravatar url from email address
|
||||
*/
|
||||
export function generateGravatarUrl(email: string = '', online: boolean = true): string {
|
||||
let emailCopy = email;
|
||||
if (online) {
|
||||
if (_.isString(email) && _.size(email) > 0) {
|
||||
emailCopy = email.trim().toLocaleLowerCase();
|
||||
const emailMD5 = stringToMD5(emailCopy);
|
||||
email = email.trim().toLocaleLowerCase();
|
||||
const emailMD5 = stringToMD5(email);
|
||||
return `https://www.gravatar.com/avatar/${emailMD5}`;
|
||||
}
|
||||
return GENERIC_AVATAR;
|
||||
|
|
Loading…
Reference in a new issue