Repository navigation
fix(links): keep purely numeric link targets as strings - #9546
Merged
Merged
Conversation
Defining the `href` attribute without a `parseHTML` function makes Tiptap's default attribute parsing cast numeric-looking strings to numbers. `isLinkToSelfWithHash` then calls `startsWith` on a number and the editor fails to open documents with links like `[test](12345678901234)` or `[[12345678901234|test]]`. Parse the href with `parseHref` so it always stays a string. This also restores the rewrite of old file-picker links to `/f/<fileId>`. Assisted-by: OpenCode:DeepSeek V4.1 Flash Signed-off-by: upskaling <upskaling@users.noreply.github.com>
upskaling
requested review from
max-nextcloud,
mejo- and
silverkszlo
as code owners
November 4, 2026 18:37
max-nextcloud
approved these changes
Nov 5, 2026
mejo-
approved these changes
Nov 5, 2026
Member
|
/backport to stable35 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Summary
href?.startsWith is not a function) #9519Opening a Markdown document containing a link with a purely numeric target
(
[test](12345678901234)or[[12345678901234|test]]) crashed the editorwith
TypeError: href?.startsWith is not a function.The link mark's
hrefattribute was defined without aparseHTMLfunction, so Tiptap fell back to its default attribute parsing, which casts
numeric-looking strings to numbers. The link pill plugin then passed that
value to
isLinkToSelfWithHash(), wherestartsWith()failed.This defines
parseHTMLforhrefusing the existingparseHref()helper,so the attribute always stays a string. It also restores the existing
rewrite of old file-picker links to
/f/<fileId>, which was bypassed by thesame default parsing.
I encountered this while using the Foam
extension for VS Code. Foam generates wiki links with numeric labels and can
emit reference definitions such as:
Closer compatibility with Foam's wiki-link format would be valuable, but it
is out of scope for this PR. This change only makes documents containing
purely numeric link targets openable again.
Regression tests cover both plain Markdown links and wiki links through the
Markdown round-trip, plus the link pill plugin. The fix was also verified
manually in a Nextcloud development instance.
🖼️ Screenshots
🚧 TODO
None.
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)🤖 AI (if applicable)