file:// links with WSL$ are not supported #13908

Closed
opened 2026-01-31 03:55:31 +00:00 by claunia · 5 comments
Owner

Originally created by @heaths on GitHub (May 25, 2021).

Windows Terminal version (or Windows build number)

1.8.1444.0

Other Software

No response

Steps to reproduce

In PowerShell running in WSL2, write a string like following:

"`e]8;;file://wsl$/${env:WSL_DISTRO_NAME}$PWD`e\$PWD`e]8;;`e\"

I do this in my $profile and while it renders and is recognized correctly, WT shows an error dialog it's not supported.

Expected Behavior

file:// links - Windows and WSL2 alike - open in Explorer when clicked.

Actual Behavior

Error dialog that the URL is not supported:

image

This same string e.g., file://wsl$/Ubuntu-18.04/home/heaths, I can copy from the error dialog (nice allowing us to copy the error, BTW!), paste into the Run dialog, and open it in Explorer.

The string also matches your regex and is automatically detected as a link, so the error must be coming from further in the code path. file://$PWD for a plain Windows directory e.g., file://C:\Users\heaths open in Explorer when Ctrl+Click'd just fine.

Originally created by @heaths on GitHub (May 25, 2021). ### Windows Terminal version (or Windows build number) 1.8.1444.0 ### Other Software _No response_ ### Steps to reproduce In PowerShell running in WSL2, write a string like following: ```powershell "`e]8;;file://wsl$/${env:WSL_DISTRO_NAME}$PWD`e\$PWD`e]8;;`e\" ``` I do this in [my $profile](https://github.com/heaths/profile/blob/5a187dfbc6d34a1bb7b4533e775fc9812c20fc54/Microsoft.PowerShell_profile.ps1#L176) and while it renders and is recognized correctly, WT shows an error dialog it's not supported. ### Expected Behavior `file://` links - Windows and WSL2 alike - open in Explorer when clicked. ### Actual Behavior Error dialog that the URL is not supported: ![image](https://user-images.githubusercontent.com/1532486/119577397-6d6fe000-bd6f-11eb-8d2a-fa677a4f69b9.png) This same string e.g., `file://wsl$/Ubuntu-18.04/home/heaths`, I can copy from the error dialog (nice allowing us to copy the error, BTW!), paste into the Run dialog, and open it in Explorer. The string also matches your [regex](https://github.com/microsoft/terminal/blob/7a41be5cd4f10e4780276ca528883ceac0f5c4a2/src/cascadia/TerminalCore/Terminal.hpp#L20) and is automatically detected as a link, so the error must be coming from further in the code path. `file://$PWD` for a plain Windows directory e.g., `file://C:\Users\heaths` open in Explorer when Ctrl+Click'd just fine.
Author
Owner

@DHowett commented on GitHub (May 25, 2021):

So this one is pretty curious. File URIs to UNC paths are poorly-specified. Terminals are recommended to reject file URIs that don't point back to the local host . . . and technically we have no way of knowing that wsl$ (or wsl.localhost) is a magic loopback thing.

@DHowett commented on GitHub (May 25, 2021): So this one is pretty curious. File URIs to UNC paths are poorly-specified. Terminals are recommended to reject file URIs that don't point back to the local host . . . and _technically_ we have no way of knowing that `wsl$` (or `wsl.localhost`) is a magic loopback _thing_.
Author
Owner

@heaths commented on GitHub (May 26, 2021):

Could well-known roots like those be handled specially? I would assume - and we could verify with Windows - that those roots are reserved (like GLOBALROOT) and can only ever resolve to localhost.

@heaths commented on GitHub (May 26, 2021): Could well-known roots like those be handled specially? I would assume - and we could verify with Windows - that those roots are reserved (like [GLOBALROOT](https://docs.microsoft.com/windows/win32/fileio/naming-a-file#namespaces)) and can only ever resolve to localhost.
Author
Owner

@DHowett commented on GitHub (May 27, 2021):

handled specially

team consensus: probably should do this, yes

@DHowett commented on GitHub (May 27, 2021): > handled specially team consensus: probably should do this, yes
Author
Owner

@heaths commented on GitHub (Aug 29, 2022):

Since a comment on another issue I'm subscribed to reminded me of this, it sounds like this is acceptable, but we should verify with Windows. I'm happy to submit a PR, but do you have any contacts in Windows that might be a good start? It's been years since I knew some contacts in somewhat related areas that could help me find someone, so hoping maybe you know of a good start.

@heaths commented on GitHub (Aug 29, 2022): Since a comment on another issue I'm subscribed to reminded me of this, it sounds like this is acceptable, but we should verify with Windows. I'm happy to submit a PR, but do you have any contacts in Windows that might be a good start? It's been years since I knew some contacts in somewhat related areas that could help me find someone, so hoping maybe you know of a good start.
Author
Owner

@zadjii-msft commented on GitHub (Sep 1, 2022):

@heaths I honestly don't think I have any good contacts in this space. Maybe @benhillis (on the WSL team) does?

@zadjii-msft commented on GitHub (Sep 1, 2022): @heaths I honestly don't think I have any good contacts in this space. Maybe @benhillis (on the WSL team) does?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13908