Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexFolder does not index links for some [[wikiLinks]] #124

Open
Jsmithrud37 opened this issue Sep 27, 2024 · 2 comments
Open

indexFolder does not index links for some [[wikiLinks]] #124

Jsmithrud37 opened this issue Sep 27, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Jsmithrud37
Copy link

Jsmithrud37 commented Sep 27, 2024

I've been experimenting with your library and discovered what appears to be a bug in indexFolder. When populating the links index, it skips [[wikiLink]] style links in cases where the wikiLink body !== relative file path.

This can be reproduced with a directory containing 2 files, separated by a level of directory hierarchy:

  • Foo.md: "[[Bar]]"
  • folder/Bar.md: ""

The resulting set of links indexed is 0 in this case, despite containing a valid [[wikiLink]], or at least a valid Obsidian-compatible wikiLink.

The function findFileToInsert in DatabaseUtils.ts seems to assume that the link target is a relative file path (excluding the extension), and will fail to recognize the wikiLink as a valid link, and the system will skip indexing it.

Whereas updating the above example to omit the sub-directory, i.e.,

  • Foo.md: "[[Bar]]"
  • Bar.md: ""

correctly results in a link being indexed.

I'm curious if this is a bug, or if this kind of Obsidian-compatible [[wikiLink]] is not supported?

@Jsmithrud37 Jsmithrud37 changed the title indexFolder does not populate links for [[wikiLinks]] indexFolder does not populate links for some [[wikiLinks]] Sep 27, 2024
@Jsmithrud37 Jsmithrud37 changed the title indexFolder does not populate links for some [[wikiLinks]] indexFolder does not index links for some [[wikiLinks]] Sep 27, 2024
@rufuspollock rufuspollock added the bug Something isn't working label Dec 28, 2024
@rufuspollock
Copy link
Member

@Jsmithrud37 good points. I think this is a bug in the code - we should be picking up those links.

@Sporarum
Copy link

Sporarum commented Feb 6, 2025

I have found an error which seems related, but I am not sure:

<!-- in file "Reproducer" -->

- [ ] [[Reproducer]]

metadata field of Reproducer in the sqlite:

{
    "tags": [],
    "tasks": [
        {
            "checked": false,
            "completion": null,
            "created": null,
            "description": "",
            "due": null,
            "metadata": {},
            "scheduled": null,
            "start": null
        }
    ]
}

Note the description is empty, instead of containing one of:

  • [[Reproducer]]
  • Reproducer
  • Some form of database link, for example the _id of Reproducer

The same issue is also present in the tasks field, if the link is surrounded by text, and regardless of if the file is in the root folder or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants