Skip to content

[Bug]: TaroURL 的 parseUrl 方法 的 origin 未考虑 port #17986

@SunriseFox

Description

@SunriseFox

请先确认

  • 我已搜索并确定这个提交不是重复的

Taro 版本

v4

相关平台

  • 所有平台
  • Web 端(H5)
  • 移动端(React-Native)
  • 鸿蒙(Harmony)
  • 鸿蒙容器(Harmony Hybrid)
  • ASCF 元服务
  • 快应用(QuickApp)
  • 所有小程序
  • 微信小程序
  • 企业微信小程序
  • 京东小程序
  • 百度小程序
  • 支付宝小程序
  • 支付宝 IOT 小程序
  • 头条小程序
  • QQ 小程序
  • 钉钉小程序
  • 飞书小程序
  • 快手小程序

小程序基础库版本

No response

使用框架

React

问题描述

result.origin = result.protocol + '//' + result.hostname

导致 new URL('/path', 'http://localhost:1234/') 返回的结果不正确

复现链接

result.origin = result.protocol + '//' + result.hostname

复现步骤

const u = new URL('/path', 'http://localhost:1234/')
u.toString() // ->  http://localhost/path

环境信息

👽 Taro v4.1.2

贡献代码

  • 我愿意修复这个错误

Metadata

Metadata

Assignees

No one assigned

    Labels

    F-reactFramework - ReactV-4Version - 4.xbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions