diff --git a/src/app/core/submission/vocabularies/vocabulary.service.spec.ts b/src/app/core/submission/vocabularies/vocabulary.service.spec.ts index faa58235203..9f6d32c44fa 100644 --- a/src/app/core/submission/vocabularies/vocabulary.service.spec.ts +++ b/src/app/core/submission/vocabularies/vocabulary.service.spec.ts @@ -352,6 +352,18 @@ describe('VocabularyService', () => { }) })); }); + + it('should encode the value', () => { + scheduler.schedule(() => service.getVocabularyEntriesByValue('https://creativecommons.org/licenses/by-sa/4.0/', false, vocabularyOptions, pageInfo).subscribe()); + scheduler.flush(); + + expect(service.findVocabularyById).toHaveBeenCalledWith(vocabularyOptions.name, true, true, jasmine.objectContaining({ + findListOptions: jasmine.objectContaining({ + filter: 'https%3A%2F%2Fcreativecommons.org%2Flicenses%2Fby-sa%2F4.0%2F', + exact: false, + }) + })); + }); }); describe('getVocabularyEntryByValue', () => { diff --git a/src/app/core/submission/vocabularies/vocabulary.service.ts b/src/app/core/submission/vocabularies/vocabulary.service.ts index 1ff5b30ee08..e384c58ce30 100644 --- a/src/app/core/submission/vocabularies/vocabulary.service.ts +++ b/src/app/core/submission/vocabularies/vocabulary.service.ts @@ -126,7 +126,7 @@ export class VocabularyService { getVocabularyEntriesByValue(value: string, exact: boolean, vocabularyOptions: VocabularyOptions, pageInfo: PageInfo): Observable>> { const options: VocabularyFindOptions = new VocabularyFindOptions( null, - value, + encodeURIComponent(value), exact, null, pageInfo.elementsPerPage,