79768: Extract download route method for Bundles with multiple Bitstreams

This commit is contained in:
Yura Bondarenko
2021-06-03 16:30:57 +02:00
parent dde57b9387
commit 9fe5a91bc2

View File

@@ -327,6 +327,21 @@ export class MetadataService {
return [getBitstreamDownloadRoute(bitstreamRd.payload.page[0])];
} else {
// Otherwise check all bitstreams to see if one matches the format whitelist
return this.getBitstreamDownloadRoute(bitstreamRd);
}
})
);
}
}),
take(1)
).subscribe((link: string) => {
// Use the found link to set the <meta> tag
this.addMetaTag('citation_pdf_url', link);
});
}
}
private getBitstreamDownloadRoute(bitstreamRd: RemoteData<PaginatedList<Bitstream>>): Observable<string> {
return observableOf(bitstreamRd.payload).pipe(
// Because there can be more than one page of bitstreams, this expand operator
// will retrieve them in turn due to the take(1) at the bottom, it will only
@@ -375,17 +390,6 @@ export class MetadataService {
map(([bitstream, ]: [Bitstream, BitstreamFormat]) => getBitstreamDownloadRoute(bitstream))
);
}
})
);
}
}),
take(1)
).subscribe((link: string) => {
// Use the found link to set the <meta> tag
this.addMetaTag('citation_pdf_url', link);
});
}
}
/**
* Add <meta name="Generator" ... > to the <head> containing the current DSpace version