fix an issue where an empty bitstream page would cause an error

This commit is contained in:
Art Lowel
2018-12-12 14:53:26 +01:00
parent 6d44381982
commit 5ed2b7536a

View File

@@ -14,7 +14,7 @@ function isObjectLevel(halObj: any) {
}
function isPaginatedResponse(halObj: any) {
return hasValue(halObj.page) && hasValue(halObj._embedded);
return hasValue(halObj.page);
}
/* tslint:disable:max-classes-per-file */
@@ -77,7 +77,9 @@ export abstract class BaseResponseParsingService {
let list = data._embedded;
// Workaround for inconsistency in rest response. Issue: https://github.com/DSpace/dspace-angular/issues/238
if (!Array.isArray(list)) {
if (hasNoValue(list)) {
list = [];
} else if (!Array.isArray(list)) {
list = this.flattenSingleKeyObject(list);
}
const page: ObjectDomain[] = this.processArray(list, requestHref);