Skip to content

SPService: escape all single quotes in list item filters - #2203

Open
bardrop wants to merge 1 commit into
pnp:devfrom
bardrop-oss:odata-filter-quotes
Open

bardrop wants to merge 1 commit into
pnp:devfrom
bardrop-oss:odata-filter-quotes

Conversation

@bardrop

@bardrop bardrop commented Nov 24, 2026

Copy link
Copy Markdown
Q A
Bug fix? [x]
New feature? [ ]
New sample? [ ]
Related issues?

What's in this Pull Request?

getListItems and getListItemsForListItemPicker only double the first single quote of the search text. With two quotes, such as l'homme d'affaires, the filter is not valid OData:

$filter=startswith(Title,'l''homme%20d'affaires')

All quotes are doubled now, the same as in the attachment methods of the service.

Tests: one case for each method, both fail without the change. The existing getListItems case also failed on dev, as it passes no field and the service reads field.TypeAsString. I gave it a text field. I ran SPService.test.ts with the SharePoint packages stubbed (17 pass), not the full build.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the first contribution to this project.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant