Skip to content

resolve() replaces the first character with backslash in external links #15714

@whataboutpereira

Description

@whataboutpereira

Describe the bug

Running an external link through resolve() breaks them.

https://live.staticflickr.com/65535/54843647922_a6f731ef05_o.jpg

is transformed into

/ttps:/live.staticflickr.com/65535/54843647922_a6f731ef05_o.jpg

What's the recommended way of dealing with mixed internal and external links?

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-udv8spkf?file=src%2Froutes%2F%2Bpage.svelte

Logs

System Info

System:
    OS: Windows 11 10.0.26200
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 2.20 GB / 15.91 GB
  Binaries:
    Node: 22.22.2 - C:\Users\reio\scoop\apps\nodejs22\current\node.EXE
    npm: 10.9.7 - C:\Users\reio\scoop\apps\nodejs22\current\npm.CMD
  Browsers:
    Chrome: 146.0.7680.178
    Edge: Chromium (140.0.3485.54)
    Firefox: 140.0.2 - C:\Program Files\Mozilla Firefox\firefox.exe
  npmPackages:
    @sveltejs/adapter-node: ^5.5.4 => 5.5.4
    @sveltejs/kit: ^2.57.1 => 2.57.1
    @sveltejs/vite-plugin-svelte: ^7.0.0 => 7.0.0
    svelte: ^5.55.2 => 5.55.2
    vite: ^8.0.8 => 8.0.8

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions