WebReflection / WebReflection/linkedom

Error when using with axios: "TypeError: Cannot read properties of undefined (reading 'charAt')"

Open
#259 1 comment 0 reactions 0 assignees View on GitHub

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:
Screenshot 2024-03-03 at 1 50 27 PM
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
Screenshot 2024-03-03 at 1 56 47 PM
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.