Command clicking an empty link results in a new empty file named ().md being created

Platform

  • Obsidian 0.14.6 (installer 0.14.6)
  • macOS 12.3.1

Bug Description

When in edit mode (new editor, not legacy) and you command-click on an empty link like the one below:

This is a test [something]()
                    ^--command click anywhere here

…Obsidian will create and switch to an entirely new, empty file, named ().md in your vault. e.g.
image

After this happens, when I open the JS console to see if any warnings or errors were displayed, I find none. In my opinion, command-clicking an empty link should not create a file named () — it should just be a no-op.

First, your example is not a wikilink, but a markdown link… :wink:

Second, maybe I don’t completely understand your problem - but of course, if you change the link’s target (which, in markdown links, is the part between “()”, whereas the first part between “[]” is the link’s alias), obsidian will create a new file in case it doesn’t exist yet.

Ah, thanks, that’s true. I updated the OP. Actually your reply led me to the repro steps, so I updated the post to include that too. I still think it’s a bug, command-clicking an empty link should not create a file named () — it should just be a no-op.

But still, that’s expected behaviour. When you click a non-existing link, the link (means: the file) will be created - that’s what obsidian does (see here)

Update: Just tried myself - though in general the creation of a new file is expected behaviour, some different things happen depending on which editor you are using:

  • With the old legacy editor, a new empty file is created in edit mode, when you ctrl + click in between the parentheses; in reading mode, though, a popup appears which is asking you if you really want obsidian to open an external link.
  • If, however, you click on the link’s alias, nothing happens at all;
  • With the new live preview mode, clicking the alias will create a new empty file as you described in your example.

At least, obsidian’s behaviour should be consistent, regardless of editor and mode; ideally,

  • nothing happens when you click an empty link
  • file will be created if you click a non-empty, non-existing link.

I can’t think of a single case where creating an empty file named () would be the desired behavior. The parentheses are never supposed to be part of the filename.

I have not yet found a consistent way to make this happen. Happened twice this week. One time I managed to get the note named with parentheses to be created, probably by additional keyboard input after that popup happened:

image

Given I do not know yet what causes it to happen, it also makes retrying in safe mode a bit of a hassle at the moment.

I searched the reports and got no hits on this, but I can also understand that parentheses are a special case for searches.

Steps to reproduce

  1. Used Ctrl+K to wrap existing text to become a link.

Expected result

Editor creating the link markup around the wrapped text and waiting for a URI to be provided within the parentheses, no popup to create a page named after parentheses.

Actual result

Got this pop up once the cursor positioned itself in the parentheses.
image

Environment

  • Operating system:
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v0.14.6
    Installer version: v0.14.2
    Operating system: Windows 10 Home 10.0.19043
    Login status: not logged in
    Insider build toggle: off
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: Obsidian gruvbox
    Snippets enabled: 0
    Safe mode: off
    Plugins installed: 2
    Plugins enabled: 2
    1: Advanced Tables
    2: Sort & Permute lines