File attachment URI doesn't support hash (#) symbol, except file:// but it doesn't encode # as %23

Steps to reproduce

Create a file with hash symbol # in its name. To make the bug obvious, the best is to put a picture because you’ll see immediately when it’s displayed or not.

Try to drag it into a sandbox in different ways:

  • simple drag (no WikiLinks)
  • simple drag (with WikiLinks)
  • Ctrl+drag (to create external file:// link)

Expected result

Non-WikiLinks and file:// formatting use URL encoding so I expect # to be turned into %23 so that they can support the symbol (instead of trying to interpret it as something else, e.g. in URL # means fragment identifier/anchor, but we don’t care about this here).

For the WikiLinks I’m not sure if # is supported (since there is no encoding), maybe it’s undistinguishable from Header internal linking for pages, then there is nothing to do about it. Unless Obsidian can understand that pictures are not .md pages and ignore the #.

Actual result

  • simply drag, no WikiLinks gives ![](file#.webp) => error “file#.webp” could not be found.
  • simply drag, with WikiLinks gives ![[file#.webp]] => error “file#.webp” could not be found.
  • Ctrl+drag for external link gives ![file#.webp](file:///home/leyn/temp/Zim/file#.webp) => broken image

Environment

SYSTEM INFO:
Obsidian version: v1.8.9
Installer version: v1.8.4
Operating system: #145-Ubuntu SMP Wed Feb 12 20:08:39 UTC 2025 5.15.0-134-generic
Login status: not logged in
Language: en
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: off
Plugins installed: 0
Plugins enabled: 0

RECOMMENDATIONS:
none


Additional information

This is a very rare bug since I only had 1 file with a hash (#) in the name. I’ll try to avoid this character from now on.

for internal links we do not support files with # in the name and you are warned not to use it.

Obsidian_hh9lq2s9nS