Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/app/app-routing-paths.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Observable, from } from 'rxjs';
import { getCollectionPageRoute } from './collection-page/collection-page-routing-paths';
import { getCommunityPageRoute } from './community-page/community-page-routing-paths';
import { Collection } from './core/shared/collection.model';
Expand All @@ -22,6 +23,16 @@ export function getBitstreamModuleRoute() {
return `/${BITSTREAM_MODULE_PATH}`;
}

export function getBitstreamRoute(item, bitstream): Observable<string> {
const name = (bitstream.metadata["dc.description"] && bitstream.metadata["dc.description"][0] ? bitstream.metadata["dc.description"][0].value : item._name)
.split('')
.map(char => ['!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '/', ':', ';', '=', '?', '@', '[', ']', ' ', '\''].includes(char) ? '_' : char)
.join('');
return from(fetch(bitstream._links.self.href)
.then(response => response.json())
.then(data => `/${LEGACY_BITSTREAM_MODULE_PATH}/handle/${item.handle}/${name}.pdf?sequence=${data.sequenceId}`));
}

export function getBitstreamDownloadRoute(bitstream): string {
return new URLCombiner(getBitstreamModuleRoute(), bitstream.uuid, 'download').toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const legacyBitstreamURLRedirectGuard: CanActivateFn = (
const filename = route.params.filename;
let sequenceId = route.params.sequence_id;
if (hasNoValue(sequenceId)) {
sequenceId = route.queryParams.sequenceId;
sequenceId = route.queryParams.sequence;
}
return bitstreamDataService.findByItemHandle(
`${prefix}/${suffix}`,
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/data/bitstream-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
const searchParams = [];
searchParams.push(new RequestParam('handle', handle));
if (hasValue(sequenceId)) {
searchParams.push(new RequestParam('sequenceId', sequenceId));
searchParams.push(new RequestParam('sequence', sequenceId));
}
if (hasValue(filename)) {
searchParams.push(new RequestParam('filename', filename));
Expand Down
Loading
Loading