Fix: escape special characters for wikipedia search, might improve #1500

This commit is contained in:
Pieter Vander Vennet 2023-07-08 02:45:12 +02:00
parent ab1220cbc4
commit ec94253d6c

View file

@ -179,7 +179,7 @@ export default class Wikidata {
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "EntitySearch" .
bd:serviceParam wikibase:endpoint "www.wikidata.org" .
bd:serviceParam mwapi:search "${text}" .
bd:serviceParam mwapi:search "${text.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}" .
bd:serviceParam mwapi:language "${options.lang}" .
?item wikibase:apiOutputItem mwapi:item .
?num wikibase:apiOrdinal true .