Fix for item pages without bitstreams

This commit is contained in:
Kristof De Langhe
2018-10-12 16:15:34 +02:00
parent 1a20cec41c
commit d18e8e1ca5

View File

@@ -269,8 +269,11 @@ export class MetadataService {
private setCitationPdfUrlTag(): void {
if (this.currentObject.value instanceof Item) {
const item = this.currentObject.value as Item;
item.getFiles().filter((files) => isNotEmpty(files)).first().subscribe((bitstreams: Bitstream[]) => {
for (const bitstream of bitstreams) {
item.getFiles()
.first((files) => isNotEmpty(files))
.catch((error) => { console.debug(error); return [] })
.subscribe((bitstreams: Bitstream[]) => {
for (const bitstream of bitstreams) {
bitstream.format.first()
.map((rd: RemoteData<BitstreamFormat>) => rd.payload)
.filter((format: BitstreamFormat) => hasValue(format))