Skip to content

[Bug] 内置浏览器输 localhost:3000(不带 http://)打不开 #1095

Closed

Description

@yuxino

What happened? / 问题描述

内置浏览器地址栏输 localhost:3000 打不开,点了没反应。加上 http:// 就能开。

Steps to reproduce / 复现步骤

  1. 在内置浏览器地址栏输入 localhost:3000(或 localhost:3000/index.html),按回车
  2. 没有任何反应

Expected behavior / 预期行为

像 example.com 那样,自动补上 http:// 打开。

Actual behavior / 实际行为

什么都不发生,不报错也不提示。

哪些行、哪些不行

地址栏里输的 结果
localhost:3000 打不开
localhost:3000/index.html 打不开
example.com:8080 打不开
127.0.0.1:3000 能开(自动补成 http://127.0.0.1:3000)
example.com 能开(自动补成 http://example.com/)
http://localhost:3000/index.html 能开

规律是:以字母开头、又带冒号的输入,会被当成"已经写了协议头",于是 localhost: 被误认成协议名。127.0.0.1 以数字开头,所以躲过去了。而本地开发服务器基本都是 localhost:3000 这种写法。

另外 apps/desktop/electron/main/browser-view.ts 里 resolveLocalFile() 的注释写着 localhost:3000/a.html 会"落到 URL 处理,而不是一次坏掉的文件加载",实际并不会,注释也过时了。

App version / 应用版本

0.15.8

Operating system / 操作系统

macOS

Activity

  1. yuxino commented on Sep 26, 2026

    @yuxino
    ContributorAuthor

    @vastsa 中秋快乐 🌕

    地址栏输 localhost:3000(不带 http://)打不开,但 127.0.0.1:3000 和 example.com 都正常,加上 http:// 也能开。

    要修的话我可以发 PR,想认领的也说一声。

  2. vastsa commented on Sep 26, 2026

    @vastsa
    Owner

    @vastsa 中秋快乐 🌕

    地址栏输 localhost:3000(不带 http://)打不开,但 127.0.0.1:3000 和 example.com 都正常,加上 http:// 也能开。

    要修的话我可以发 PR,想认领的也说一声。

    中秋快乐,欢迎pr,哈哈哈,浏览器这块一直没时间优化,如果有时间欢迎参与哈哈哈

  3. yuxino commented on Sep 26, 2026

    @yuxino
    ContributorAuthor

    @vastsa 哈哈哈哈,好的,这几个 issuse 是 pi-desktop 里用 deepseek 发的,编辑了好几次 (deepseek 没调教好,有点不说人话 ~~~

  4. vastsa commented on Sep 26, 2026

    @vastsa
    Owner

    @vastsa 哈哈哈哈,好的,这几个 issuse 是 pi-desktop 里用 deepseek 发的,编辑了好几次 (deepseek 没调教好,有点不说人话 ~~~

    哈哈哈哈问题不大现在都是ai调查了

  5. vastsa commented on Sep 27, 2026

    @vastsa
    Owner

    这个问题已由 #1121 修复并合入 main。回归覆盖了 localhost、带端口的点分主机,以及 file:/javascript: 等不支持 scheme 的拒绝路径。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions