Bugfix: Only try to load file if there's a path

This commit is contained in:
Cássio Zen
2017-01-19 17:28:06 -02:00
parent 4dd0c0ccb5
commit d237318ef4

View File

@ -162,7 +162,10 @@ export default class API {
const unpublishedPromise = this.retrieveMetadata(contentKey) const unpublishedPromise = this.retrieveMetadata(contentKey)
.then((data) => { .then((data) => {
metaData = data; metaData = data;
return this.readFile(data.objects.entry.path, null, data.branch); if (data.objects.entry.path) {
return this.readFile(data.objects.entry.path, null, data.branch);
}
return Promise.reject(null);
}) })
.then(fileData => ({ metaData, fileData })) .then(fileData => ({ metaData, fileData }))
.catch(() => { .catch(() => {