-
-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
What is Hapening
When querying a card by name that contain apostrophes like Lillie's Clefairy ex or Professor's Research we do not get any results.
This is due to the encoder not handling apostrophes correctly.
return encodeURI(
str.toString()
.replace("?", "%3F")
.normalize("NFC")
.replace(/["'\u0300-\u036f]/gu, "") // <- Problematic line
);
Please explain what should happen
I checked TCGdex.encode, which builds the URL https://api.tcgdex.net/v2/en/cards?name=Professors%20Research
When removing the 'in the replace function, we get the correct URL:
https://api.tcgdex.net/v2/en/cards?name=Professor%27s%20Research
Unless I am missing any good reason to keep it that way, I would like to change this. Otherwise I would not know how to query those cards by name.
If thats ok I'll make a pull request
Please give us a way to reproduce
const dex = new TCGdex("en");
let cardRes = await dex.card.list(
Query.create()
.equals("name", "Professor's Research")
);
if (cardRes.length === 0) {
console.error("No such card")
}
const card = await cardRes[0].getCard();
console.log(card)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working