Skip to content

[BUG] Copy Link to Page generates identical links for pages in different external notebooks #128

Open

Description

@DWAA1660

Environment

Windows, Rust 1.99.1, NoteCraft 0.0.9 at 33429876e885613f6ff8f29a762b15b2be736401 (current main when tested). Verified against the real workspace libraries / front end with synthetic files and an isolated profile. No product source changes or mocks.

Reproduction

  1. Open two notebooks located outside the main notebooks root: away1/book-a and away2/book-b.
  2. Give each a section named Section and a page named Page.
  3. Generate each page's Copy Link to Page target using the actual links::page_uri with roots [main_root, book_a, book_b].
  4. Resolve the link generated for Book B with links::resolve_in against those open roots.

Actual result

Both different pages receive the identical URI:

A: notecraft:/section/page
B: notecraft:/section/page

Resolving B's copied link opens Book A's page, because it is the first root with that relative path. The target changes with root order. Reproduced on real notebook folders using the public store APIs.

Expected result

A page link must identify the intended notebook and page unambiguously. Copying B's link must open B, regardless of the order notebooks were opened and whether another notebook has the same section/page names.

Cause / coverage

links.rs, page_uri, strips the matched root. For an external notebook that root is the notebook itself, so the notebook identity disappears. resolve_in then returns the first matching path under any root.

Include the notebook identity in the link contract and cover two external notebooks with identical layouts. This is separate from Unicode parsing (#102) and missing targets after moving a page.

Duplicate check

Checked all open/closed issues and PRs, including the first audit's #102-#116 and new PRs #117-#120. No existing issue or PR covering this specific behavior was found.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions