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

Wrong detected backlinks #273

Closed
UnkwUsr opened this issue Nov 29, 2022 · 2 comments
Closed

Wrong detected backlinks #273

UnkwUsr opened this issue Nov 29, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@UnkwUsr
Copy link

UnkwUsr commented Nov 29, 2022

Example (description below):

% ls -1
1.md
2.md
asd.md
prefixed-asd.md
%
% bat --decorations=always *
───────┬───────────────────────────────────────────────────────
       │ File: 1.md
───────┼───────────────────────────────────────────────────────
   1   │ # one
   2   │
   3   │ * [just filename](asd)
───────┴───────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────
       │ File: 2.md
───────┼───────────────────────────────────────────────────────
   1   │ # two
   2   │
   3   │ * [prefixed filename](prefixed-asd)
───────┴───────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────
       │ File: asd.md
───────┼───────────────────────────────────────────────────────
   1   │ # just filename
───────┴───────────────────────────────────────────────────────
───────┬───────────────────────────────────────────────────────
       │ File: prefixed-asd.md
───────┼───────────────────────────────────────────────────────
   1   │ # prefixed filename
───────┴───────────────────────────────────────────────────────
%
% zk list -l asd
one 1.md (8 minutes ago)

  ‣ [just filename](asd)

two 2.md (8 minutes ago)

  ‣ [prefixed filename](prefixed-asd)


Found 2 notes
%

The problem is that zk says that there are two backlinks to asd.md, but you can clearly see that there is only one link to it.

Note that our wrong backlinked file (prefixed-asd.md) ends with the same part as real one backlinked file (asd.md).

P.S. I know zk provides randomly generated filenames, but anyway I think it's strange behavior.

zk-bug-test.tar.gz

@github-actions github-actions bot added the stale No recent activity label Jan 13, 2023
@zk-org zk-org deleted a comment from github-actions bot Jan 13, 2023
@mickael-menu mickael-menu added bug Something isn't working and removed stale No recent activity labels Jan 13, 2023
@jurica jurica self-assigned this Jan 4, 2024
@jurica
Copy link
Member

jurica commented Jan 9, 2024

After taking a close look I'm not so sure if we really should classify this as a bug.
By design the list command (and its filters) accepts one or more (partial) paths and not a specific note.
For reference please check https://github.com/zk-org/zk/blob/main/docs/note-id.md as well as https://github.com/zk-org/zk/blob/main/docs/note-filtering.md#filter-by-path from the documentation.

In my opinion we shouldn't change this behaviour as it's expected and documented as is but either

  1. extend the link-to filter in a smart way
  2. or even better introduce a new cli command that operates on a single note and achieves the desired functionality.

Any opinions here?

@tjex
Copy link
Member

tjex commented Jan 22, 2024

@jurica @UnkwUsr I agree.

The query is not intended to be an exact match.
This functions the same as search. If you were to search for 'asd' in your files. It would return 'asd.md' as well as 'prefixed-asd.md'.

This is a case for using unique id's for filenames :)

An option would be to include and 'exact' flag, which would then require the query to match the filename / file path exactly.

But as we're in maintenance for the moment, it's not practical to look at implementing that any time soon.

Closing for now. @UnkwUsr feel free to keep tabs on when we're out of maintenance mode, and request and --exact flag for zk list.

@tjex tjex closed this as completed Jan 22, 2024
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

4 participants