mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
79768: Extract download route method for Bundles with multiple Bitstreams
This commit is contained in:
@@ -327,6 +327,21 @@ export class MetadataService {
|
|||||||
return [getBitstreamDownloadRoute(bitstreamRd.payload.page[0])];
|
return [getBitstreamDownloadRoute(bitstreamRd.payload.page[0])];
|
||||||
} else {
|
} else {
|
||||||
// Otherwise check all bitstreams to see if one matches the format whitelist
|
// 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(
|
return observableOf(bitstreamRd.payload).pipe(
|
||||||
// Because there can be more than one page of bitstreams, this expand operator
|
// 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
|
// 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))
|
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
|
* Add <meta name="Generator" ... > to the <head> containing the current DSpace version
|
||||||
|
Reference in New Issue
Block a user