Automatically updating wikilinks changes the custom link text when it matches the link name

Steps to reproduce

  1. Enable Files and links>Automatically update internal links
  2. Type the following into a new note Pet Preference:
    I'd prefer a cat instead of a [[Dog|dog]].
    
  3. Follow the link to create the note
  4. Rename the file to dog
  5. Rename the file again to Dog

Did you follow the troubleshooting guide? [Y/N]

Yes

Expected result

Pet Preference should contain:

I'd prefer a cat instead of a [[Dog|dog]].

Note text is preserved.

Actual result

Pet Preference contains:

I'd prefer a cat instead of a [[Dog|Dog]].

Note text is not preserved: dogDog

Environment

SYSTEM INFO:
	Obsidian version: v1.5.11
	Installer version: v1.4.16
	Operating system: Windows 10 Pro 10.0.19045
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: on

RECOMMENDATIONS:
	none

Additional information

This requested feature describes what I was trying to achieve. I realised I should just add custom text to every wikilink to keep the link text stable. Then I immediately ran into the above bug where the custom text is not preserved.

It might be sensible to add an option to automatically add identical custom text to new wikilinks (e.g. [[dog+return[[dog|dog]]) to support users who expect link text to be stable. Personally I want link text to be stable by default and unstable link text to be an explicit choice.

1 Like

I just realised that the same problem occurs for regular markdown links too:

I'd prefer a cat instead of a [dog](Dog.md).