mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
79698: Escape browse by author data requests
This commit is contained in:
@@ -127,7 +127,8 @@ describe('BrowseService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getBrowseEntriesFor and findList', () => {
|
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(() => {
|
beforeEach(() => {
|
||||||
requestService = getMockRequestService(getRequestEntry$(true));
|
requestService = getMockRequestService(getRequestEntry$(true));
|
||||||
@@ -152,7 +153,7 @@ describe('BrowseService', () => {
|
|||||||
|
|
||||||
describe('when findList is called with a valid browse definition id', () => {
|
describe('when findList is called with a valid browse definition id', () => {
|
||||||
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => {
|
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.schedule(() => service.getBrowseItemsFor(mockAuthorName, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
|
||||||
scheduler.flush();
|
scheduler.flush();
|
||||||
|
@@ -130,7 +130,7 @@ export class BrowseService {
|
|||||||
args.push(`startsWith=${options.startsWith}`);
|
args.push(`startsWith=${options.startsWith}`);
|
||||||
}
|
}
|
||||||
if (isNotEmpty(filterValue)) {
|
if (isNotEmpty(filterValue)) {
|
||||||
args.push(`filterValue=${filterValue}`);
|
args.push(`filterValue=${encodeURIComponent(filterValue)}`);
|
||||||
}
|
}
|
||||||
if (isNotEmpty(args)) {
|
if (isNotEmpty(args)) {
|
||||||
href = new URLCombiner(href, `?${args.join('&')}`).toString();
|
href = new URLCombiner(href, `?${args.join('&')}`).toString();
|
||||||
|
Reference in New Issue
Block a user