Skip to content

fix: relative url 2 full url use error base url#584

Merged
mogery merged 1 commit intofirecrawl:mainfrom
dolonfly:bugfix/fix-20240830
Feb 13, 2025
Merged

fix: relative url 2 full url use error base url#584
mogery merged 1 commit intofirecrawl:mainfrom
dolonfly:bugfix/fix-20240830

Conversation

@dolonfly
Copy link
Contributor

according to : https://developer.mozilla.org/en-US/docs/Web/API/URL/URL

new URL(url, base)
base Optional
A string representing the base URL to use in cases where url is a relative reference. If not specified, it defaults to undefined.

eg:

  • pageUrl = http://example.com/a/b/c/d.html
  • tag : <a herf="../e.html"></a>

correct: new URL('../e.html','http://example.com/a/b/c/d.html')
incorrect: new URL('../e.html','http://example.com')

according to : https://developer.mozilla.org/en-US/docs/Web/API/URL/URL 

the second  parameter:  A string representing the base URL to use in cases where url is a relative reference

so need use the pageUrl , not url origin

eg: 
when pageUrl = http://example.com/a/b/c/d.html and tag a  href is '../e.html'
then 
correct: new URL('../e.html','http://example.com/a/b/c/d.html')
incorrect: new URL('../e.html','http://example.com')
@dolonfly dolonfly marked this pull request as ready for review August 29, 2024 16:42
@nickscamara nickscamara requested a review from mogery August 30, 2024 20:11
@mogery
Copy link
Member

mogery commented Sep 1, 2024

Good catch! Thank you!

@simensol
Copy link

@mogery Could you please clarify the reason for the delay in merging this pull request?

@mogery
Copy link
Member

mogery commented Feb 13, 2025

My bad. Merging.

@mogery mogery merged commit 254580a into firecrawl:main Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants