WebReflection / WebReflection/linkedom
Error when using with axios: "TypeError: Cannot read properties of undefined (reading 'charAt')"
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 2.1k
- Forks
- 104
- PR merge metrics
- No merged PRs in 30d
Description
When used with axios I'm finding this error:
I did the work of following the stack trace and found where is the problem. At line 41 in https://github.com/axios/axios/blob/v1.x/lib/helpers/isURLSameOrigin.js
Seems like Axios checks if the browser is a "standard" one by creating an element. The problem is that it expects that when you create an anchor element it sets itself the pathname property when you add the href property.
I tried setting the user agent to msie or trident but the issue is still showing up
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Axios's lib/helpers/isURLSameOrigin.js at line 41 and trace the anchor element behavior described in the report. Compare how creating an anchor and assigning href affects pathname in linkedom versus Axios's expectation; done means the reported Axios error no longer occurs and the anchor exposes the expected pathname.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100