fix(netlify-cms-core): files collection blank label (#1987)

This commit is contained in:
Bartholomew 2019-01-10 22:25:53 +01:00 committed by Shawn Erquhart
parent b1e490dce5
commit f2e4800989

View File

@ -300,13 +300,14 @@ class Backend {
}
getEntry(collection, slug) {
return this.implementation
.getEntry(collection, slug, selectEntryPath(collection, slug))
.then(loadedEntry =>
const path = selectEntryPath(collection, slug);
const files = collection.get('files');
const label = files && files.find(f => f.get('file') === path).get('label');
return this.implementation.getEntry(collection, slug, path).then(loadedEntry =>
this.entryWithFormat(collection, slug)(
createEntry(collection.get('name'), slug, loadedEntry.file.path, {
raw: loadedEntry.data,
label: loadedEntry.file.label,
label,
}),
),
);