TriliumNext / Notes

Build your personal knowledge base with TriliumNext Notes
GNU Affero General Public License v3.0
740 stars 37 forks source link

(Bug report) Error when Duplicating subtree of note that contains broken internal trilium link #308

Closed meichthys closed 1 month ago

meichthys commented 1 month ago

TriliumNext Version

0.90.3

What operating system are you using?

Windows

What is your setup?

Local (no sync)

Operating System Version

Trilium Server Accessed via Firefox v129

Description

image

This seems to be a regression as this works in zadam/Trilium

Error logs

13:14:16.724 Duplicating 'RhTknDcnnKjF' subtree into 'root'
13:14:16.754 Transaction rollback dirtied the becca, forcing reload.
13:14:16.955 Becca (note cache) load took 201ms
13:14:16.957 ERROR: post /api/notes/:noteId/duplicate/:parentNoteId threw exception: 'Cannot save relation 'internalLink' of note '4f4eZ1fouyqK' since it targets not existing note 'p7HlnAeZNK9z'.', stack: Error: Cannot save relation 'internalLink' of note '4f4eZ1fouyqK' since it targets not existing note 'p7HlnAeZNK9z'.
    at BAttribute.validate (file:///usr/src/app/src/becca/entities/battribute.js:78:19)
    at BAttribute.beforeSaving (file:///usr/src/app/src/becca/entities/battribute.js:137:18)
    at BAttribute.save (file:///usr/src/app/src/becca/entities/abstract_becca_entity.js:82:14)
    at createDuplicatedNote (file:///usr/src/app/src/services/notes.js:776:18)
    at duplicateSubtreeInner (file:///usr/src/app/src/services/notes.js:797:19)
    at createDuplicatedNote (file:///usr/src/app/src/services/notes.js:780:17)
    at duplicateSubtreeInner (file:///usr/src/app/src/services/notes.js:797:19)
    at Object.duplicateSubtree (file:///usr/src/app/src/services/notes.js:715:17)
    at duplicateSubtree (file:///usr/src/app/src/routes/api/notes.js:118:24)
    at Function.cb (file:///usr/src/app/src/routes/routes.js:373:34)
13:14:17.101 JS Error: 500 POST notes/RhTknDcnnKjF/duplicate/root - Cannot save relation 'internalLink' of note '4f4eZ1fouyqK' since it targets not existing note 'p7HlnAeZNK9z'.
Stack: w@https://trilium.domain.org/assets/v0.90.3/app-dist/desktop.js:2:159540
g@https://trilium.domain.org/assets/v0.90.3/app-dist/desktop.js:2:149419
c@https://trilium.domain.org/assets/v0.90.3/app-dist/desktop.js:2:145612