0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

fix(web): fix sidebar tarball protocol (#1326)

fix: #1320 https://github.com/verdaccio/verdaccio/issues/1320
This commit is contained in:
Honza Hommer 2019-05-28 22:24:40 +02:00 committed by Juan Picado @jotadeveloper
parent 2e71daacfd
commit de0446376d

View file

@ -2,9 +2,8 @@
* @prettier * @prettier
* @flow * @flow
*/ */
import _ from 'lodash'; import _ from 'lodash';
import { addScope, addGravatarSupport, deleteProperties, sortByName, parseReadme, formatAuthor } from '../../../lib/utils'; import { addScope, addGravatarSupport, deleteProperties, sortByName, parseReadme, formatAuthor, convertDistRemoteToLocalTarballUrls } from '../../../lib/utils';
import { allow } from '../../middleware'; import { allow } from '../../middleware';
import { DIST_TAGS, HEADER_TYPE, HEADERS, HTTP_STATUS } from '../../../lib/constants'; import { DIST_TAGS, HEADER_TYPE, HEADERS, HTTP_STATUS } from '../../../lib/constants';
import { generateGravatarUrl } from '../../../utils/user'; import { generateGravatarUrl } from '../../../utils/user';
@ -102,7 +101,8 @@ function addPackageWebApi(route: Router, storage: IStorageHandler, auth: IAuth,
callback: function(err: Error, info: $SidebarPackage) { callback: function(err: Error, info: $SidebarPackage) {
if (_.isNil(err)) { if (_.isNil(err)) {
let sideBarInfo: any = _.clone(info); let sideBarInfo: any = _.clone(info);
sideBarInfo.latest = info.versions[info[DIST_TAGS].latest]; sideBarInfo.versions = convertDistRemoteToLocalTarballUrls(info, req, config.url_prefix).versions;
sideBarInfo.latest = sideBarInfo.versions[info[DIST_TAGS].latest];
sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author); sideBarInfo.latest.author = formatAuthor(sideBarInfo.latest.author);
sideBarInfo = deleteProperties(['readme', '_attachments', '_rev', 'name'], sideBarInfo); sideBarInfo = deleteProperties(['readme', '_attachments', '_rev', 'name'], sideBarInfo);
if (config.web) { if (config.web) {