Skip to content

Commit

Permalink
Encode Filter String characters
Browse files Browse the repository at this point in the history
  • Loading branch information
joaojmendes committed Oct 21, 2019
1 parent d871abd commit 729f24a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/SPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class SPService implements ISPService {
const filter: string = filterList ? `and ${filterList}` : '';
try {
const webAbsoluteUrl = !webUrl ? this._context.pageContext.web.absoluteUrl : webUrl;
const apiUrl = `${webAbsoluteUrl}/_api/web/lists('${listId}')/items?$select=${keyInternalColumnName || 'Id'},${internalColumnName}&$filter=startswith(${internalColumnName},'${filterText}') ${filter}`;
const apiUrl = `${webAbsoluteUrl}/_api/web/lists('${listId}')/items?$select=${keyInternalColumnName || 'Id'},${internalColumnName}&$filter=startswith(${internalColumnName},'${encodeURIComponent(filterText.replace("'","''"))}') ${filter}`;
const data = await this._context.spHttpClient.get(apiUrl, SPHttpClient.configurations.v1);
if (data.ok) {
const results = await data.json();
Expand Down

0 comments on commit 729f24a

Please sign in to comment.