Skip to content

[BUG] External change to the current note is overwritten by autosave when the file is replaced via rename (Windows) #3862

Backlog

Description

@skylord123

Expected behaviour

When another program changes the current note on disk and I haven't edited that note in QOwnNotes, QOwnNotes should load the new text (I have "accept all external modifications" on). At the very least it should never write its old copy back over the file, since nothing was changed in QOwnNotes.

Actual behaviour

If the other program saves by writing a temp file and renaming it over the note (sed -i, many editors, sync clients), QOwnNotes ignores the change. About 4 seconds later autosave stores the old editor text, so the external change is silently lost. No dialog is shown, and note checksum checks (which I have on) don't catch it.

Changing the same file in place (open, write, truncate) works fine: QOwnNotes shows "Current note was modified externally" and reloads.

This is on 26.11.13 on Windows, with the notes folder in OneDrive. My AI agents edit my notes from WSL, and two of their edits were reverted this way today. I checked 26.11.14, 26.11.15 and main, and the code involved hasn't changed.

Steps to reproduce

  1. Open a note in QOwnNotes and leave it alone for more than 60 seconds.
  2. From another program, change one line by replacing the file. From WSL, for example:
    sed -i 's/Holiday (/Thanksgiving Holiday (/' "note-01.md"
  3. Wait about 5 seconds. The file on disk has the old text again, and the log shows Old and new text are same or similar, ignoring followed by Stored 1 note(s) to disk.
  4. Make the same change in place instead, for example with Python open(path, 'r+'), write, truncate(). QOwnNotes reloads it and doesn't save over it.

Screenshots

N/A

Output from the debug section in the settings dialog

Expand

QOwnNotes Debug Information

General Info

Current Date: Wed Nov 25 13:29:02 2026
Version: 26.11.12
Build date: Nov 19 2026
Build number: 1421
Platform: windows (windows)
Operating System: Windows 11 Version 25H2
Build architecture: x86_64
Current architecture: x86_64
Release: GitHub Actions
Qt Version (build): 6.10.1
Qt Version (runtime): 6.10.1
KDE integration: disabled
Windows font smoothing: enabled
Windows font engine: DirectWrite (default)
Windows font antialiasing: default
Portable mode: no
Settings path / key: \HKEY_CURRENT_USER\Software\PBE\QOwnNotes
Settings override path: /HKEY_CURRENT_USER/Software/PBE/QOwnNotes.override
Settings loaded from override: 0
Application database path: C:\Users\<user>\AppData\Roaming\PBE\QOwnNotes\QOwnNotes.sqlite
Application arguments: C:\Users\<user>\OneDrive - <org>\Documents\programs\qownnotes v26.11.13\QOwnNotes.exe
Qt Debug: no
System Botan: no
Libgit2: yes
QLiteHtml: yes
Locale (system): en_US
Locale (interface): empty
Primary screen resolution: 1920x1200
Screen resolution(s): 1920x1200, 1920x1200, 1920x1080
Icon theme: breeze-dark-qownnotes
Notes in current note folder: 347
Calendar items: 0
Enabled scripts: 0
Database drivers: QIBASE, QSQLITE, QMIMER, QOCI, QODBC, QPSQL

Server Info

serverUrl: https://<nextcloud-server>
appIsValid: no
notesPathExists: empty
connectionErrorMessage: empty

Spellchecking

Enabled: false
Selected language: auto
Language codes: empty
Language names: empty
Application dictionaries path: C:\Users\<user>\AppData\Roaming\PBE\QOwnNotes\dicts

Note folders

currentNoteFolderId: 1

Note folder note-folder-1

id: 1
isCurrent: yes
activeTagId: -1
localPath: C:\Users\<user>\OneDrive - <org>\Notes
remotePath: /note-folder-1
cloudConnectionId: 1
isShowSubfolders: yes
isUseGit: no
allowDifferentNoteFileName: no
activeNoteSubFolder name: note-subfolder
database file: C:\Users\<user>\OneDrive - <org>\Notes\notes.sqlite

Cloud connections

Cloud connection cloud-connection-1

id: 1
isCurrent: yes
serverUrl: https://<nextcloud-server>
username: <cloud-connection-1-user>
accountId: <cloud-connection-1-account>

Enabled scripts

Settings

AboutDialog/geometry (QByteArray): <binary data>
ActiveNoteHistoryItem (NoteHistoryItem): empty
ColorModes/ColorMode-dark/accentColor (QString): empty
ColorModes/ColorMode-dark/darkMode (QString): true
ColorModes/ColorMode-dark/darkModeColors (QString): true
ColorModes/ColorMode-dark/darkModeIconTheme (QString): true
ColorModes/ColorMode-dark/darkModeTrayIcon (QString): true
ColorModes/ColorMode-dark/editorColorSchemaKey (QString): EditorColorSchema-cdbf28fc-1ddc-4d13-bb21-6a4043316a2f
ColorModes/ColorMode-dark/internalIconTheme (QString): false
ColorModes/ColorMode-dark/name (QString): Dark
ColorModes/ColorMode-dark/systemIconTheme (QString): false
ColorModes/ColorMode-light/accentColor (QString): empty
ColorModes/ColorMode-light/darkMode (QString): false
ColorModes/ColorMode-light/darkModeColors (QString): false
ColorModes/ColorMode-light/darkModeIconTheme (QString): false
ColorModes/ColorMode-light/darkModeTrayIcon (QString): false
ColorModes/ColorMode-light/editorColorSchemaKey (QString): EditorColorSchema-6033d61b-cb96-46d5-a3a8-20d5172017eb
ColorModes/ColorMode-light/internalIconTheme (QString): false
ColorModes/ColorMode-light/name (QString): System
ColorModes/ColorMode-light/systemIconTheme (QString): false
ColorModes/currentId (QString): ColorMode-dark
ColorModes/ids (QStringList): ColorMode-light, ColorMode-dark
Debug/fakeOldScriptVersions (QString): false
Debug/fakeOldVersionNumber (QString): false
Debug/fileLogging (QString): true
Debug/scriptProfilingThreshold (int): 500
DistractionFreeMode/hideStatusBar (QString): false
DistractionFreeMode/isEnabled (QString): false
DistractionFreeMode/menuBarGeometry (QByteArray): <binary data>
DistractionFreeMode/menuBarHeight (int): 33
DistractionFreeMode/menuBarVisible (QString): true
DistractionFreeMode/openInFullScreen (QString): true
DistractionFreeMode/windowState (QByteArray): <binary data>
Editor/CurrentSchemaKey (QString): EditorColorSchema-cdbf28fc-1ddc-4d13-bb21-6a4043316a2f
Editor/autoBracketClosing (QString): true
Editor/autoBracketRemoval (QString): true
Editor/autocompleteApplySingleResult (QString): false
Editor/autocompleteNoSpace (QString): false
Editor/centerCursor (QString): false
Editor/disableCursorBlinking (QString): false
Editor/editorWidthInDFMOnly (QString): true
Editor/enableFontLigatures (QString): false
Editor/ensureEmptyLastLine (QString): false
Editor/hangingIndent (QString): false
Editor/headingFolding (QString): false
Editor/hideFormattingSyntax (QString): false
Editor/highlightCurrentLine (QString): true
Editor/indentSize (int): 4
Editor/markdownLspArguments (QStringList): empty
Editor/markdownLspCommand (QString): marksman
Editor/markdownLspEnabled (QString): false
Editor/markdownLspVerboseLogging (QString): false
Editor/multilineInlineHighlighting (QString): true
Editor/removeTrailingSpaces (QString): false
Editor/showLineEndingMarkers (QString): false
Editor/showLineNumbers (QString): false
Editor/showMarkdownImagePreviews (QString): true
Editor/showNoteTextStats (QString): false
Editor/showWhitespaceMarkers (QString): false
Editor/useTabIndent (QString): false
Editor/vimMode (QString): false
Editor/wikiLinkFileNameAutoSelect (QString): false
Editor/wikiLinkSupport (QString): false
IssueAssistantDialog/geometry (QByteArray): <binary data>
LastUpdateCheck (QDateTime): 2026-11-25T12:55:32.379
LinkDialog/geometry (QByteArray): <binary data>
LocalTrashDialog/geometry (QByteArray): <binary data>
LocalTrashDialog/trashTreeWidgetHeaderOrder/order (QStringList): 0, 1
LocalTrashDialog/trashTreeWidgetHeaderOrder/widths (QStringList): 100, 100
MainWindow/geometry (QByteArray): <binary data>
MainWindow/mainToolBar.iconSize (int): 24
MainWindow/menuBarGeometry (QByteArray): <binary data>
MainWindow/noteSubFolderTreeWidgetExpandState-1 (QStringList): folder-01, folder-02, folder-03
MainWindow/noteTextEdit.code.font (QString): Courier New,10,-1,2,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextEdit.font (QString): MS Shell Dlg 2,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.code.font (QString): Courier New,9,-1,2,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.export.font (QString): MS Shell Dlg 2,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.font (QString): MS Shell Dlg 2,8.25,-1,5,400,0,0,0,0,0,0,0,0,0,0,1
MainWindow/noteTextView.ignoreCodeFontSize (QString): true
MainWindow/noteTextView.refreshDebounceTime (int): 600
MainWindow/noteTextView.rtl (QString): false
MainWindow/noteTextView.underline (QString): true
MainWindow/noteTextView.useEditorStyles (QString): true
MainWindow/noteTextView.useInternalExportStyling (QString): true
MainWindow/showNotesFromAllNoteSubFolders (QString): false
NoteFolder-1/NoteTabNameList (QStringList): note-01, note-02, note-03, note-04, note-05, note-06, note-07, note-08
NoteFolder-1/NoteTabStickinessList (QStringList): 0, 1, 2, 7
NoteFolder-1/NoteTabSubFolderPathDataList (QStringList):

folder-01, folder-02, folder-01, folder-02, , folder-02, folder-01/folder-04, folder-02

NoteHistory-1 (QVariantList): <variant list with 54 item(s)>
NoteHistoryCurrentIndex-1 (int): 53
PiwikClientId (QString): <hidden>
ScriptRepositoryDialog/mainSplitterState (QByteArray): <binary data>
SearchEngineId (int): 2
SettingsDialog/geometry (QByteArray): <binary data>
SettingsDialog/mainSplitterState (QByteArray): <binary data>
ShowSystemTray (QString): false
StartHidden (QString): false
TextDiffDialog/geometry (QByteArray): <binary data>
WelcomeDialog/geometry (QByteArray): <binary data>
accentColor (QString): empty
acceptAllExternalModifications (QString): true
ai/autocompleteEnabled (QString): false
ai/groq/apiKey (QString): <hidden>
ai/mcpServerEnabled (QString): false
ai/mcpServerPort (int): 22226
ai/mcpServerToken (QString): <hidden>
ai/openai/apiKey (QString): <hidden>
ai/openrouter/apiKey (QString): <hidden>
ai/responseTimeout (int): 15
allowEmptyNotes (QString): true
allowNoteEditing (bool): true
allowOnlyOneAppInstance (QString): true
appMetrics/disableAppHeartbeat (QString): false
appMetrics/disableTracking (QString): false
appMetrics/notificationShown (QString): true
autoReadOnlyMode (QString): false
autoReadOnlyModeTimeout (int): 30
automaticNoteFolderDatabaseClosing (QString): false
centralWidget (QString): note-edit
checkSpelling (bool): false
closeTodoListAfterSave (QString): false
cryptoKey (qlonglong): <hidden>
currentLayout (QString): initial
currentNoteFolderId (int): 1
cursorWidth (int): 1
darkMode (QString): true
darkModeColors (QString): true
darkModeIconTheme (QString): true
darkModeTrayIcon (QString): true
debugInfoAnonymize (bool): true
defaultNoteFileExtension (QString): md
detectLeadingEmojiInNoteTitle (QString): true
disableAutomaticUpdateDialog (QString): true
disableSavedSearchesAutoCompletion (QString): false
dockWasInitializedOnce (QString): true
enableNoteChecksumChecks (QString): true
enableNoteTree (QString): false
enableReadOnlyMode (QString): true
enableSocketServer (QString): true
enableWebAppSupport (QString): false
externalDiffToolPath (QString): empty
externalEditorPath (QString): empty
fullyHighlightedBlockquotes (QString): false
gitCommitInterval (int): 30
gitExecutablePath (QString): empty
gitLogCommand (QString): empty
guiFirstRunInit (bool): true
harperBinaryPath (QString): harper-ls
harperCheckDelay (int): 1500
harperDialect (QString): American
harperEnabled (QString): false
harperEnabledLinters (QStringList): SpellCheck, SentenceCapitalization, RepeatedWords, LongSentences, AnA, UnclosedQuotes, CorrectNumberSuffix, Spaces, QuoteSpacing, NoFrenchSpaces, WrongApostrophe
harperTcpAddress (QString): 127.0.0.1
harperTcpPort (int): 4000
harperTransportMode (int): 0
hideIconsInMenus (QString): false
hideTabCloseButton (QString): false
ignoreAllExternalModifications (QString): false
ignoreAllExternalNoteFolderChanges (QString): false
ignoreNoteSubFolders (QString): ^\.
ignoredNoteFiles (QString): empty
imageScaleDown (QString): false
imageScaleDownMaximumHeight (int): 1024
imageScaleDownMaximumWidth (int): 1024
initialLayoutPresetIdentifier (QString): minimal
insertTimeFormat (QString): empty
interfaceFontEngine (QString): auto
interfaceFontSize (int): 11
interfaceLanguage (QString): empty
interfaceScalingFactor (int): 100
internalIconTheme (QString): false
itemHeight (int): 15
keychainTimeout (int): 2
languageToolApiKey (QString): <hidden>
languageToolCheckDelay (int): 1500
languageToolEnabled (QString): false
languageToolEnabledCategories (QStringList): TYPOS, GRAMMAR, STYLE, REDUNDANCY, PUNCTUATION, TYPOGRAPHY
languageToolLanguage (QString): auto
languageToolServerUrl (QString): http://localhost:8081
languageToolUsername (QString): empty
layout-initial/centralWidget (QString): note-edit
layout-initial/name (QString): Minimal
layout-initial/noteEditIsCentralWidget (QString): true
layout-initial/noteSubFolderDockWidgetVisible (QString): true
layout-initial/windowState (QByteArray): <binary data>
layouts (QStringList): initial
legacyLinking (QString): false
localTrash/autoCleanupDays (int): 30
localTrash/autoCleanupEnabled (QString): true
localTrash/mode (int): 2
localTrash/supportEnabled (QString): true
localTrashSplitterSizes (QByteArray): <binary data>
markdownHighlightingEnabled (QString): true
maxNoteFileSize (int): 1048576
navigationPanelAutoSelect (QString): true
navigationPanelHideSearch (QString): false
networking/ignoreSSLErrors (QString): true
networking/proxyType (int): 2
newNoteAskHeadline (QString): false
newNoteUseSetextHeadings (QString): false
noteEditIsCentralWidget (bool): true
noteFileExtensionList (QStringList): md, txt
noteListPreview (QString): false
noteSaveIntervalTime (int): 10
noteSearchPanelOpenCreatedNotesInNewTab (QString): false
noteSubfoldersPanelDisplayAsFullTree (QString): true
noteSubfoldersPanelHideSearch (QString): false
noteSubfoldersPanelOrder (int): 0
noteSubfoldersPanelShowFullPath (QString): false
noteSubfoldersPanelShowNotesRecursively (QString): false
noteSubfoldersPanelShowRootFolderName (QString): true
noteSubfoldersPanelSort (int): 0
noteSubfoldersPanelTabsUnsetAllNotesSelection (QString): false
notesPanelOrder (int): 0
notesPanelSort (int): 1
notesPath (QString): C:/Users/<user>/OneDrive - <org>/Notes
notifyAllExternalModifications (QString): false
overrideInterfaceFontSize (QString): false
overrideInterfaceScalingFactor (QString): false
ownCloud/supportEnabled (QString): true
ownCloud/todoCalendarBackend (int): 3
ownCloud/todoCalendarCalDAVPassword (QString): <hidden>
ownCloud/todoCalendarCalDAVServerUrl (QString): empty
ownCloud/todoCalendarCalDAVUsername (QString): empty
ownCloud/todoCalendarCloudConnectionId (int): 1
ownCloud/todoCalendarDisplayNameList (QStringList): empty
ownCloud/todoCalendarEnabledList (QStringList): empty
ownCloud/todoCalendarEnabledUrlList (QStringList): empty
ownCloud/todoCalendarUrlList (QStringList): empty
ownCloudInfo/appIsValid (bool): false
ownCloudInfo/connectionErrorMessage (QString): empty
ownCloudInfo/notesPathExistsText (QString): empty
ownCloudInfo/serverVersion (QString): empty
previousLayout (QString): initial
restoreCursorPosition (QString): true
restoreLastNoteAtStartup (QString): true
restoreNoteTabs (QString): true
savedSearches/noteFolder-1 (QStringList): <anonymized string list with 12 item(s)>
searchIgnoreAccents (QString): false
security/keychainMigrationNoticeAcknowledged (QString): true
showMatches (QString): true
showMenuBar (bool): true
showStatusBar (bool): true
showStatusBarNotePath (QString): true
showStatusBarRelativeNotePath (QString): false
startInReadOnlyMode (QString): false
stripLeadingEmojiFromNoteFilename (QString): true
systemIconTheme (QString): false
taggingShowNotesRecursively (QString): false
tagsPanelHideNoteCount (QString): false
tagsPanelHideSearch (QString): false
tagsPanelOrder (int): 0
tagsPanelSort (int): 0
todoCalendarSupport (QString): true
toolbar/1/items (QStringList): action_New_note, action_Find_note, action_Remove_note, action_Open_note_in_external_editor, actionShow_local_trash, actionShow_note_git_versions, actionAllow_note_editing, , action_Back_in_note_history, action_Forward_in_note_history, , action_Find_text_in_note, actionReplace_in_current_note, , actionShow_versions, actionShow_trash, actionShare_note, , actionShow_Todo_List
toolbar/1/name (QString): mainToolBar
toolbar/1/title (QString): main toolbar
toolbar/2/items (QStringList): actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote
toolbar/2/name (QString): formattingToolbar
toolbar/2/title (QString): formatting toolbar
toolbar/3/items (QStringList): actionInsert_text_link, actionInsert_image, actionInsert_current_time
toolbar/3/name (QString): insertingToolbar
toolbar/3/title (QString): inserting toolbar
toolbar/4/items (QStringList): action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note
toolbar/4/name (QString): encryptionToolbar
toolbar/4/title (QString): encryption toolbar
toolbar/5/items (QStringList): actionEnable_AI, actionAiBackendComboBox, actionAiModelComboBox
toolbar/5/name (QString): aiToolbar
toolbar/5/title (QString): AI toolbar
toolbar/6/items (QStringList): actionWorkspaceComboBox, actionStore_as_new_workspace, actionRemove_current_workspace, actionRename_current_workspace, actionSwitch_to_previous_workspace, actionUnlock_panels, , actionToggle_distraction_free_mode, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size
toolbar/6/name (QString): windowToolbar
toolbar/6/title (QString): window toolbar
toolbar/7/items (QStringList): action_Quit
toolbar/7/name (QString): quitToolbar
toolbar/7/title (QString): quit toolbar
toolbar/size (int): 7
useNoteFolderButtons (QString): false
useUNIXNewline (QString): false
webAppClientService/connectionName (QString): qownnotes-<user>-<computer>-1
webAppClientService/serverUrl (QString): wss://app.qownnotes.org
webAppClientService/token (QString): <hidden>
webSocketServerService/bookmarkSuggestionApiEnabled (QString): false
webSocketServerService/bookmarkSuggestionApiPort (int): 22224
webSocketServerService/bookmarkSuggestionApiToken (QString): <hidden>
webSocketServerService/bookmarksNoteName (QString): Bookmarks
webSocketServerService/bookmarksTag (QString): bookmarks
webSocketServerService/commandSnippetsNoteName (QString): Commands
webSocketServerService/commandSnippetsTag (QString): commands
webSocketServerService/port (int): 22222
webSocketServerService/token (QString): <hidden>

System environment

****: ::=::\
ALLUSERSPROFILE: C:\ProgramData
APPDATA: C:\Users\<user>\AppData\Roaming
CommonProgramFiles: C:\Program Files\Common Files
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
CommonProgramW6432: C:\Program Files\Common Files
COMPUTERNAME: <anonymized>
ComSpec: C:\windows\system32\cmd.exe
DriverData: C:\Windows\System32\Drivers\DriverData
EFC_37068_1592913036: 1
EFC_37068_4126798990: 0
HOMEDRIVE: C:
HOMEPATH: \Users\<user>
LOCALAPPDATA: C:\Users\<user>\AppData\Local
LOGONSERVER: <anonymized>
NUMBER_OF_PROCESSORS: 28
OneDrive: C:\Users\<user>\OneDrive - <org>
OneDriveCommercial: C:\Users\<user>\OneDrive - <org>
OS: Windows_NT
Path: C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files\Docker\Docker\resources\bin;C:\Users\<user>\AppData\Local\Microsoft\WindowsApps;C:\Users\<user>\AppData\Roaming\npm
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE: AMD64
PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
PROCESSOR_LEVEL: 6
PROCESSOR_REVISION: b701
ProgramData: C:\ProgramData
ProgramFiles: C:\Program Files
ProgramFiles(x86): C:\Program Files (x86)
ProgramW6432: C:\Program Files
PSModulePath: C:\Program Files\WindowsPowerShell\Modules;C:\windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC: C:\Users\Public
SESSIONNAME: Console
SystemDrive: C:
SystemRoot: C:\windows
TEMP: C:\Users\<user>\AppData\Local\Temp
TMP: C:\Users\<user>\AppData\Local\Temp
USERDNSDOMAIN: <anonymized>
USERDOMAIN: <anonymized>
USERDOMAIN_ROAMINGPROFILE: <anonymized>
USERNAME: <anonymized>
USERPROFILE: C:\Users\<user>
windir: C:\windows

Relevant log output in the Log panel

Expand

Sanitized log attached. It covers 12:55 to 13:20. User, org, note and folder names are replaced with placeholders, and the Nextcloud share lines are removed.

sanitized.log

Replace via rename (change lost):

[13:06:06] notesDirectoryWasModified:  "C:/Users/<user>/OneDrive - <org>/Notes\\folder-01"
[13:06:06] � Notes directory was modified externally
[13:06:10] checkModifiedNote  - 'str':  "C:/Users/<user>/OneDrive - <org>/Notes/folder-01/note-01.md"
[13:06:10] checkModifiedNote  - Modification date didn't change, continuing
[13:06:10] checkModifiedNote  - Old and new text are same or similar, ignoring
[13:06:10] updateNoteText:  false
[13:06:14] storing note file:  "note-01.md"
[13:06:14] stored note:  Note: <id>9 <name>"note-01" <fileName>"note-01.md" <noteSubFolderId>1 <relativePath>"folder-01" <hasDirtyData>false
[13:06:14] storeUpdatedNotesToDisk  - 'count':  1
[13:06:14] � Stored 1 note(s) to disk

The same thing happened again from 13:10:47 to 13:10:55.

In-place write (works):

[13:10:40] � Notes directory was modified externally
[13:10:45] checkModifiedNote  - Modification date didn't change, continuing
[13:10:45] � Current note was modified externally
[13:10:45] updateNoteText:  false

No storing note file follows, and the editor shows the new text.

Additional context

Here's what I think is happening, from reading the 26.11.13 source:

  1. Replacing the file drops it from noteDirectoryWatcher, because Qt stops watching a path when the file goes away.
  2. In NoteIndexManager::notesDirectoryWasModified, subfolderMatchesIndex() returns false early at !watchedPaths.contains(notePath), before it compares the text. So changedNotePaths stays empty. (This is the Windows subfolder check from [BUG] QOwnNotes freezes during OneDrive synchronization #3847, which otherwise works great.)
  3. reloadAfterDirectoryChange() rebuilds the index first, so the note's text and checksum in the database already match the new file.
  4. checkModifiedNote(path, false) compares oldNoteText (the new text, freshly indexed) with the text on disk. They're equal, so it logs "Old and new text are same or similar, ignoring" and returns. The editor still shows the old text.
  5. The next storeUpdatedNotesToDisk() calls noteTextEditTextWasUpdated(), which sees that the editor and disk differ and stores the editor text as if I had typed it. The checksum check in Note::storeNoteTextFileToDisk passes, because step 3 already refreshed _fileChecksum.

An in-place write keeps the watcher attached, so the text comparison runs, the note lands in changedNotePaths, and the similarity shortcut is skipped. That's why only replaced files are affected.

Some ideas for a fix:

  • In subfolderMatchesIndex(), treat a note that exists but isn't in watchedPaths as changed (add it to changedNotePaths) instead of returning early, and re-attach the watcher.
  • In checkModifiedNote(), compare the disk text with the editor text or _currentNoteTextHash, not with the freshly re-indexed oldNoteText.
  • In noteTextEditTextWasUpdated(), don't treat "editor differs from disk" as an edit when the note hasn't been typed in since it was loaded.

Related: #3468 (changes made by a move aren't detected), #3636 (same overwrite symptom, closed as stale), #3838 (autosave overwriting during the external-change dialog), #3847.

Activity

  1. pbek commented on Nov 26, 2026

    @pbek
    Owner

    Thanks for the detailed report. The next release (26.11.16) will fix the case where replacing an open, unedited note could leave the editor showing stale text and autosave could then overwrite the external change. QOwnNotes will compare the replacement against the version last loaded or saved by the editor, and autosave will no longer treat a difference on disk as a local edit when the editor is untouched.

    The Linux VM regression test passed: two consecutive replacements appeared in the editor and both survived autosave on disk. Once 26.11.16 is available, could you confirm that the same test works on Windows with OneDrive? This may also address #3468.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions