Updating Internal Links: Removes File Extension When Using Markdown Links

Steps to reproduce

  1. Verify that in Obsidian’s settings, the “Use Markdown Links” in the Editor section is enabled.

  2. Link to a note using the autocomplete suggestion. Depending on your path settings & where the note is, your result will look similar to:

    • [Note](Note.md)
  3. Move the file that you linked to. After updating it will now look like:

    • [Note](Note)

This causes it to loose it’s file extension, which is not a big deal for Obsidian. Obsidian doesn’t seem to mind at all, but when using it with other software the other software can’t find the file that it links to without it’s extension.

This same sort of behavior also happens when linking to sections of the same file: Moving a note breaks internal links

Expected result

Only the information that changed to be updated.

Actual result

The destination file name was unnecessarily changed.

Environment

  • Operating system: Windows 10
  • Obsidian version: 0.9.2

Additional information

3 Likes

This has actually consequences for interoperability as well and can be confusing to tryage. An example is my feature request Reconsider requirement for markdown links to be urlencoded, wherein I thought at first the problem was that another app (DevonThink in this case) was unable to use urlencoded relative paths only to find out later, that it was actually just the missing extension that caused problems.

Steps to reproduce

  1. Create a folder testfolder
  2. Create a file testfile1.md in the folder
  3. Create a file testfile2.md in other folder(not in testfolder)
  4. Link testfile1.md in testfile2.md with a markdown link
[a_link](./testfolder/testfile1.md)
  1. Rename testfolder to folder, make sure the link will be automatically updated

Expected result

[a_link](./folder/testfile1.md)

Actual result

The file suffix will be lost like this:

[a_link](./folder/testfile1)

Environment

  • Operating system: Windows 10 version 1909
  • Obsidian version: 0.9.15

Additional information

This is fixed at least as of 0.9.20