Permalink
Browse files

🐛 `@phenomic/plugin-collector-files`: fix edge case when you request …

…an index file with an id (db was not correctly filled)
  • Loading branch information...
MoOx committed Apr 1, 2018
1 parent 6a265de commit a8648fcf5de98d21024d5853f56b7f9cdf08859f
Showing with 6 additions and 3 deletions.
  1. +6 −3 packages/plugin-collector-files/src/index.js
@@ -91,13 +91,16 @@ const collectorFiles: PhenomicPluginModule<{}> = () => {
const id = getId(name, json);
const { filename, allPaths } = parsePath(name);
const adjustedJSON = injectData(filename, json);
debug(`collecting ${filename}`, adjustedJSON);
debug(`collecting '${filename}'`, adjustedJSON);
// full resource, not sorted
db.put(null, id, adjustedJSON);
return allPaths.map(pathName => {
const relativeKey = id.replace(pathName + sep, "");
let relativeKey = id.replace(pathName + sep, "");
if (relativeKey === pathName) {
relativeKey = "";
}
const sortedKey = relativeKey;
debug(`collecting ${relativeKey} for path '${pathName}'`);
debug(`collecting '${relativeKey}' for path '${pathName}'`);
db.put([pathName], relativeKey, adjustedJSON);
db.put([pathName, "default"], sortedKey);
Object.keys(json.data).map(type => {

0 comments on commit a8648fc

Please sign in to comment.