Microsoft/vscode

cannot open UNC file links in Markdown

Open

#270403 opened on Oct 8, 2025

View on GitHub
 (8 comments) (0 reactions) (1 assignee)TypeScript (74,848 stars) (10,221 forks)batch import
bughelp wantedmarkdown-ext

Description

Type: Bug

VS Code fails to open valid UNC file paths in Markdown documents, even with the appropriate settings configured. The same UNC file can be opened by other tools (e.g., notepad.exe, Python), and the Markdown link is recognized visually in the preview — but clicking the link results in an error.

🔁 Reproduction Steps

Create a .md file with a UNC link:

Resource

With this Syntax, the Preview show a link.

But VS Code can't find: "2025-10-08 17:52:19.121 [error] [Window] Error: The editor could not be opened because the file was not found."

Confirm file is accessible: ✅ notepad.exe "\ts453\wissen\Resources\readme.md" → works ✅ Python open() with UNC → works

❌ code "\ts453\wissen\Resources\readme.md" → fails

Try clicking the link in Markdown Preview (Ctrl+Click): File is not opened

Console log shows:

Error: Unable to read file '\ts453\wissen\Resources\readme.md' (Unknown (FileSystemError): UNC host 'ts453' access is not allowed. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.) 🔧 Configuration

Relevant settings.json entries:

"security.allowedUNCHosts": ["ts453"], "markdown.unsafe.allowUNC": true, "security.workspace.trust.untrustedFiles": "open"

📚 RFC / Standards Notes

  • file:// is defined in RFC 8089
  • UNC syntax (\host\share) is fully supported by Windows
  • Markdown itself (e.g., CommonMark) does not forbid such links
  • File can be accessed programmatically and by Windows natively

❗Expected Behavior

When the Markdown preview recognizes a file:// link pointing to a UNC path, VS Code should resolve and open the file, especially if the path has been explicitly allowed via security.allowedUNCHosts.

✅ Workaround

Using notepad or Python to access the file confirms that the issue is within VS Code’s internal file resolution logic, not a system or network-level restriction.

🔧 Configuration

Relevant settings.json entries:

"security.allowedUNCHosts": ["ts453"], "markdown.unsafe.allowUNC": true, "security.workspace.trust.untrustedFiles": "open"

📚 RFC / Standards Notes

file:// is defined in RFC 8089

UNC syntax (\host\share) is fully supported by Windows

Markdown itself (e.g., CommonMark) does not forbid such links. File can be accessed programmatically and by Windows natively

💬 Final Notes

This appears to be a bug or unintended policy handling in Markdown preview or file system access logic. If intentional, it should be clearly documented. If not, it would help many Windows-based users working with network shares via Markdown.

VS Code version: Code 1.104.3 (385651c938df8a906869babee516bffd0ddb9829, 2025-10-02T12:30:51.747Z) OS version: Windows_NT x64 10.0.26100 Modes:

Item Value
CPUs AMD Ryzen 7 5700U with Radeon Graphics (16 x 1797)
GPU Status 2d_canvas: enableddirect_rendering_display_compositor: disabled_off_okgpu_compositing: enabledmultiple_raster_threads: enabled_onopengl: enabled_onrasterization: enabledraw_draw: disabled_off_okskia_graphite: disabled_offtrees_in_viz: disabled_offvideo_decode: enabledvideo_encode: enabledvulkan: disabled_offwebgl: enabledwebgl2: enabledwebgpu: enabledwebnn: disabled_off
Load (avg) undefined
Memory (System) 31.34GB (12.64GB free)
Process Argv Z:\ --goto Z:\status.md
Screen Reader no
VM 0%
Extension Author (truncated) Version
emojisense bie 0.10.0
markdown-preview-github-styles bie 2.2.0
gitlens eam 17.6.0
black-formatter ms- 2025.2.0
debugpy ms- 2025.10.0
isort ms- 2025.0.0
pylint ms- 2025.2.0
python ms- 2025.14.0
vscode-pylance ms- 2025.8.3
powershell ms- 2025.2.0
vsliveshare ms- 1.0.5959
autodocstring njp 0.6.1
material-icon-theme PKi 5.27.0
LiveServer rit 5.7.9
markdowntable Tak 0.13.0
markdown-all-in-one yzh 3.6.3

Contributor guide