mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
79698: Escape browse by author data requests
This commit is contained in:
@@ -127,7 +127,8 @@ describe('BrowseService', () => {
|
||||
});
|
||||
|
||||
describe('getBrowseEntriesFor and findList', () => {
|
||||
const mockAuthorName = 'Donald Smith';
|
||||
// should contain special characters such that url encoding can be tested as well
|
||||
const mockAuthorName = 'Donald Smith & Sons';
|
||||
|
||||
beforeEach(() => {
|
||||
requestService = getMockRequestService(getRequestEntry$(true));
|
||||
@@ -152,7 +153,7 @@ describe('BrowseService', () => {
|
||||
|
||||
describe('when findList is called with a valid browse definition id', () => {
|
||||
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => {
|
||||
const expected = browseDefinitions[1]._links.items.href + '?filterValue=' + mockAuthorName;
|
||||
const expected = browseDefinitions[1]._links.items.href + '?filterValue=' + encodeURIComponent(mockAuthorName);
|
||||
|
||||
scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
|
||||
scheduler.flush();
|
||||
|
@@ -130,7 +130,7 @@ export class BrowseService {
|
||||
args.push(`startsWith=${options.startsWith}`);
|
||||
}
|
||||
if (isNotEmpty(filterValue)) {
|
||||
args.push(`filterValue=${filterValue}`);
|
||||
args.push(`filterValue=${encodeURIComponent(filterValue)}`);
|
||||
}
|
||||
if (isNotEmpty(args)) {
|
||||
href = new URLCombiner(href, `?${args.join('&')}`).toString();
|
||||
|
Reference in New Issue
Block a user