Skip to content

Commit

Permalink
fix: adds _id to normalise metadata (#1194)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayusharma committed Jan 21, 2019
1 parent 056d396 commit e2fa581
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/storage-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ function normalizePackage(pkg: Package) {
pkg._rev = DEFAULT_REVISION;
}

if (_.isString(pkg._id) === false) {
pkg._id = pkg.name;
}

// normalize dist-tags
normalizeDistTags(pkg);

Expand Down Expand Up @@ -107,7 +111,7 @@ export function normalizeContributors(contributors: Array<Author>): Array<Author
return contributors;
}

export const WHITELIST = ['_rev', 'name', 'versions', 'dist-tags', 'readme', 'time'];
export const WHITELIST = ['_rev', 'name', 'versions', 'dist-tags', 'readme', 'time', '_id'];

export function cleanUpLinksRef(keepUpLinkData: boolean, result: Package): Package {
const propertyToKeep = [...WHITELIST];
Expand Down

0 comments on commit e2fa581

Please sign in to comment.