Remove folder from the "Copy Obsidian URL" menu

Steps to reproduce

  1. In the editor, click 3-dot thing and copy Obsidian URL
  2. Store it somewhere else and forget about it
  3. Move the file around in the vault
  4. Link is now broken

Expected result

  • Copy Obsidian URL returns a deep link to the object.
  • When the request comes in:
    1. If the file is there, awesome.
      - that’s the one to return.
    2. If the file can not be found, remove the path, see if there is exactly one match
      • that’s the one to return
    3. If neither method works, show an error and send the user to the search box.

Copying the link with Copy Obsidian URL should return the link without a directory if it is unique. (the least specific link possible).
That’ll make the link much more stable.

Actual result

Obsidian always returns a very specific link with a directory. That makes the links brittle.

Here’s a user help request:

Environment

  • Operating system: 11.0.1
  • Obsidian version: 0.9.19
3 Likes

Let’s say we do what you want. One day I create a link to file in dir1. Another day I create a file with the same name in the root. The URI link I created a few days back now points to another file. Do you think this is appropriate? I can see another bug report coming.

So… I am gonna move this feature requests.

OK, how about this:

  • Copy Obsidian URL returns a deep link to the object.
  • When the request comes in:
    1. If the file is there, awesome.
      • that’s the one to return.
    2. If the file can not be found, remove the path, see if there is exactly one match
      • that’s the one to return
    3. If neither method works, show an error and send the user to the search box.

This would improve link stability while retaining all the specificity that is possible to retain.

1 Like

I can’t reproduce this. The URL generated by the three dot menu is in the format obsidian://open?vault=<my-vault>&file=<my-file>. That link works regardless of the folder my-file is in. Renaming a file or moving it outside the vault is the only thing that would break it.

Edit: Something missing from the steps to reproduce this is that the file in question should be inside a folder, in which case the second part of the url returns my-folder/my-file. For now a work around is to remove the folder from the URL. I’ll update the title of the feature request.

This is the reason/motivation for using UID-only based filenames.
They enable to rename note titles and move files without breaking the links in form obsidian://vault/<vaultname>/<noteUID>, including links stored externally.

  • Opening such link does not require searching/indexing content of all files in the vault, just the filenames.
  • We can change title by any application easily because links do not have to be updated/renamed.
  • Versioning/backup systems need to create/store new version only for renamed file, not for all files that link to it.

Better support for separation between filename and title is requested in:


Existing support for aliases helps with usability of knowledge base based on files with UID-only filenames.

keywords: Unique, Zettelkasten

UIDs are available to anyone if you want to use Zettelkasten file names.
A file-UID that is separate from the file name would have to be maintained somewhere and would surely cause user lockin - which is exactly what Obsidian is avoiding so awesomely.

It would be possible to add a switch that warns the user or complains about duplicate file names even though they live in different directories. I’d like that, but it seems odd. It would make each file name a unique ID though, but it’s really a strange paradigm.

1 Like

Can we revive this and look for a way to implement it?

The way I’m thinking of, is that each file/note as an ID that is internal and not user changeable.
And the url will be using the ID instead of file name.

4 Likes