You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I noticed, that the description request fails for some events that have "ß", "ü" or similar characters in them.
This results in the error "Too Many Redirects".
My Attempts To Fix This
I have tried upping the maxRedirects property of the Axios request but with no success.
I have played around with this function axios.get("https://www.wowhead.com/de/event=634")
The URL Axios tries to request is the following: https://www.wowhead.com/de/event=634/das-gro%C3%83%C2%9Fe-hippogryphenschl%C3%83%C2%BCpfen
which Axios does not seem to work with since this keeps redirecting. (It does work in a normal browser)
Though when I manually give Axios this URL (which i directly copied from my browser): https://www.wowhead.com/de/event=634/das-gro%C3%9Fe-hippogryphenschl%C3%BCpfen
it does work.
Notice the additional %83%C2 which seems to break the code.
The Workaround
As you can see in my latest push 84733e0 for version v2.2.0 i have now implemented this workaround:
try{letdescription=axios.get(`https://www.wowhead.com/${locale}/event=${JSON.parse(filteredResults[i].id)}`).then(({ data })=>{letmetaTag=data.match('<meta name="description" content="(?:.*)">','gi');returnmetaTag[0].replace('<meta name="description" content="','').replace('">','');});// Add the description to the event object and push it to the activeEvents arrayfilteredResults[i].description=awaitdescription;filteredResults[i].descriptionLocale=locale;// Set a flag to indicate that the description request was successful and no fallback was usedfilteredResults[i].descriptionFallback=false;activeEvents.push(filteredResults[i]);}catch{//Fallback to "en" if the chosen description locale request results in too many redirectsletdescription=axios.get(`https://www.wowhead.com/en/event=${JSON.parse(filteredResults[i].id)}`).then(({ data })=>{letmetaTag=data.match('<meta name="description" content="(?:.*)">','gi');returnmetaTag[0].replace('<meta name="description" content="','').replace('">','');});// Add the description to the event object and push it to the activeEvents arrayfilteredResults[i].description=awaitdescription;filteredResults[i].descriptionLocale="en";// Set a flag to indicate that the description has been replaced with a fallbackfilteredResults[i].descriptionFallback=true;activeEvents.push(filteredResults[i]);}
This workaround just falls back to "en" locale, which does not seem to have this Too Many Redirects issue (at least at this moment).
It also sets the flag descriptionFallback = true; to indicate, that this description is a fallback to english.
Help Wanted!
I really want to get this working with all the different locales without issues and not with this sloppy workaround.
Maybe some of you reading this have better ideas than I have and can maybe help me with this issue.
I do appreciate everyone who creates a Pull Request to help me fix this bug.
The text was updated successfully, but these errors were encountered:
I noticed that after i pushed the github workflow worked with Node v18+. So it seems to be an issue with the node version (my stupid ahh still used Node 16 oof)
Today I noticed, that the description request fails for some events that have "ß", "ü" or similar characters in them.
This results in the error "Too Many Redirects".
My Attempts To Fix This
I have tried upping the maxRedirects property of the Axios request but with no success.
I have played around with this function
axios.get("https://www.wowhead.com/de/event=634")
The URL Axios tries to request is the following:
https://www.wowhead.com/de/event=634/das-gro%C3%83%C2%9Fe-hippogryphenschl%C3%83%C2%BCpfen
which Axios does not seem to work with since this keeps redirecting. (It does work in a normal browser)
Though when I manually give Axios this URL (which i directly copied from my browser):
https://www.wowhead.com/de/event=634/das-gro%C3%9Fe-hippogryphenschl%C3%BCpfen
it does work.
Notice the additional
%83%C2
which seems to break the code.The Workaround
As you can see in my latest push 84733e0 for version v2.2.0 i have now implemented this workaround:
This workaround just falls back to "en" locale, which does not seem to have this Too Many Redirects issue (at least at this moment).
It also sets the flag
descriptionFallback = true;
to indicate, that this description is a fallback to english.Help Wanted!
I really want to get this working with all the different locales without issues and not with this sloppy workaround.
Maybe some of you reading this have better ideas than I have and can maybe help me with this issue.
I do appreciate everyone who creates a Pull Request to help me fix this bug.
The text was updated successfully, but these errors were encountered: