Skip to content

Commit

Permalink
Fix: Ensure normalizeURL retains port number (FlowiseAI#3959)
Browse files Browse the repository at this point in the history
* fix: Preserve port in normalizeURL function

The normalizeURL function was previously ignoring the port in the URL.
This fix explicitly includes the port if present (e.g., `:3000`).

* fix lint problem

fix lint problem
  • Loading branch information
jeme95 authored and tenuar committed Feb 9, 2025
1 parent a3087f3 commit 1be62b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/components/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,8 @@ function getURLsFromHTML(htmlBody: string, baseURL: string): string[] {
*/
function normalizeURL(urlString: string): string {
const urlObj = new URL(urlString)
const hostPath = urlObj.hostname + urlObj.pathname + urlObj.search
const port = urlObj.port ? `:${urlObj.port}` : ''
const hostPath = urlObj.hostname + port + urlObj.pathname + urlObj.search
if (hostPath.length > 0 && hostPath.slice(-1) == '/') {
// handling trailing slash
return hostPath.slice(0, -1)
Expand Down

0 comments on commit 1be62b4

Please sign in to comment.