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

[I] Path to note in link does not change #3200

Open
DemidovDG opened this issue Jan 1, 2025 · 10 comments
Open

[I] Path to note in link does not change #3200

DemidovDG opened this issue Jan 1, 2025 · 10 comments
Labels
Importance: Medium Type: Improvement improves existing functionality

Comments

@DemidovDG
Copy link

Expected behaviour

I create a link in the note ./folder_1/note_1 to another note ./folder_2/note_2:

[note_2](../folder_2/note_2)

When moving the note ./folder_1/note_1 to a higher or lower directory, for example, to ./folder_1/subfolder_1/note_1, the link path to the note should update to ../../folder_2/note_2 to remain valid.

Actual behaviour

The link path remains unchanged: ../folder_2/note_2. As a result, the link becomes invalid and does not work.

Steps to reproduce

  1. Create two notes: ./folder_1/note_1 and ./folder_2/note_2.
  2. Add a link in the first note pointing to the second note.
  3. Move the first note to a higher or lower directory.
@pbek
Copy link
Owner

pbek commented Jan 1, 2025

That doesn't look like a correct note link.
Best use the note link dialog to see how to create a link to another Markdown note file (Ctrl + Shift + L).

@DemidovDG
Copy link
Author

Yes, I am adding the link using the shortcut Ctrl + Shift + L. I am using QOwnNotes (Portable) 24.12.7 on Windows 10

Here, I added a link to the note "Markdown Cheatsheet" located in "Notes/QOwnNotes/Welcome". The link is in a note located in "Notes/First_test".

изображение


изображение

@pbek
Copy link
Owner

pbek commented Jan 1, 2025

Do you have the same issue without portable mode?

@DemidovDG
Copy link
Author

Yes, here I tried the non-portable version. The paths in the links still look the same. And the paths do not change when moving the note to other directories.

qownnotes_test

@pbek
Copy link
Owner

pbek commented Jan 2, 2025

I just tried and can't reproduce your issue. I get a dialog that tells me that linked notes need to change...

You never shared your settings.
Do you have the same issue when running QOwnNotes in a new session (see cli-parameters)?

@DemidovDG
Copy link
Author

You never shared your settings.

My omission, I thought the issue was specifically with the logic of the code itself. Here are my settings that I used for testing (I only changed the settings related to language and translation. I don't remember touching anything more significant).

QOwnNotes Debug Information

General Info

Current Date: Чт янв 2 17:11:54 2025
Version: 24.12.7
Build date: Dec 27 2024
Build number: 1149
Platform: windows (windows)
Operating System: Windows 10 Version 1909
Build architecture: x86_64
Current architecture: x86_64
Release: GitHub Actions
Qt Version (build): 5.15.2
Qt Version (runtime): 5.15.2
Portable mode: no
Settings path / key: \HKEY_CURRENT_USER\Software\PBE\QOwnNotes
Application database path: C:\Users\admin\AppData\Roaming\PBE\QOwnNotes\QOwnNotes.sqlite
Application arguments: C:\Users\admin\programs\QOwnNotes\QOwnNotes.exe
Qt Debug: 0
Locale (system): ru_RU
Locale (interface): en
Primary screen resolution: 1920x1080
Icon theme: breeze-dark-qownnotes
Notes in current note folder: 4
Calendar items: 0
Enabled scripts: 0
Database drivers: QSQLITE, QODBC, QODBC3, QPSQL, QPSQL7

Server Info

serverUrl: empty
appIsValid: no
notesPathExists: empty
connectionErrorMessage: empty

Spellchecking

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

Note folders

currentNoteFolderId: 1

Note folder My_notes

id: 1
isCurrent: yes
activeTagId: -2
localPath: C:\Users\admin\Notes
remotePath: Notes
cloudConnectionId: 1
isShowSubfolders: yes
isUseGit: no
allowDifferentNoteFileName: yes
activeNoteSubFolder name: folder_1
database file: C:\Users\admin\Notes\notes.sqlite

Cloud connections

Cloud connection По умолчанию

id: 1
isCurrent: yes
serverUrl: empty
username: empty
accountId: empty

Enabled scripts

Settings

ActiveNoteHistoryItem (NoteHistoryItem): <binary data>
Debug/fakeOldVersionNumber (QString): false
Debug/fileLogging: empty
Editor/CurrentSchemaKey (QString): EditorColorSchema-2f30b571-9e15-4762-8ed9-7f2c6862e934
Editor/autoBracketClosing (QString): true
Editor/autoBracketRemoval (QString): true
Editor/disableCursorBlinking (QString): false
Editor/editorWidthInDFMOnly (QString): true
Editor/highlightCurrentLine (QString): true
Editor/indentSize (int): 4
Editor/removeTrailingSpaces (QString): false
Editor/showLineNumbers (QString): false
Editor/useTabIndent (QString): false
Editor/vimMode (QString): false
LastUpdateCheck (QDateTime): 2025-01-02T17:10:41.156
LinkDialog/geometry (QByteArray): <binary data>
MainWindow/geometry (QByteArray): <binary data>
MainWindow/mainToolBar.iconSize (int): 30
MainWindow/menuBarGeometry (QByteArray): <binary data>
MainWindow/noteSubFolderTreeWidgetExpandState-1 (QStringList): folder_1
MainWindow/noteTextEdit.code.font (QString): Courier New,13,-1,2,50,0,0,0,0,0
MainWindow/noteTextEdit.font (QString): MS Shell Dlg 2,12,-1,5,50,0,0,0,0,0
MainWindow/noteTextView.code.font (QString): Courier New,9,-1,2,50,0,0,0,0,0
MainWindow/noteTextView.font (QString): MS Shell Dlg 2,7.8,-1,5,50,0,0,0,0,0
MainWindow/noteTextView.ignoreCodeFontSize (QString): true
MainWindow/noteTextView.refreshDebounceTime (int): 600
MainWindow/noteTextView.rtl (QString): false
MainWindow/noteTextView.underline (QString): false
MainWindow/noteTextView.useEditorStyles (QString): true
MainWindow/noteTextView.useInternalExportStyling (QString): true
MainWindow/showNotesFromAllNoteSubFolders (QString): false
NoteFolder-1/NoteTabNameList (QStringList): note_1
NoteFolder-1/NoteTabStickinessList (QStringList): empty
NoteFolder-1/NoteTabSubFolderPathDataList (QStringList): folder_1
NoteFolder-1/allowDifferentNoteFileName (bool): true
NoteHistory-1 (QVariantList): <variant list with 6 item(s)>
NoteHistoryCurrentIndex-1 (int): 4
PiwikClientId (QString): <hidden>
SearchEngineId (int): 2
SettingsDialog/geometry (QByteArray): <binary data>
SettingsDialog/mainSplitterState (QByteArray): <binary data>
ShowSystemTray (QString): false
StartHidden (QString): false
WelcomeDialog/geometry (QByteArray): <binary data>
acceptAllExternalModifications (QString): false
ai/groq/apiKey (QString): <hidden>
ai/openai/apiKey (QString): <hidden>
allowNoteEditing (bool): true
allowOnlyOneAppInstance (QString): true
appMetrics/disableAppHeartbeat (QString): true
appMetrics/disableTracking (QString): true
appMetrics/notificationShown (QString): true
autoReadOnlyMode (QString): false
autoReadOnlyModeTimeout (int): 30
automaticNoteFolderDatabaseClosing (QString): false
checkSpelling (bool): false
closeTodoListAfterSave (QString): false
cryptoKey (qlonglong): <hidden>
currentNoteFolderId (int): 1
currentWorkspace (QString): initial
cursorWidth (int): 1
darkMode (QString): true
darkModeColors (QString): true
darkModeIconTheme (QString): true
darkModeTrayIcon (QString): false
defaultNoteFileExtension (QString): md
demoNotesCreated (QString): true
disableAutomaticUpdateDialog (QString): true
disableSavedSearchesAutoCompletion (QString): false
dockWasInitializedOnce (QString): true
enableNoteTree (QString): false
enableSocketServer (QString): true
enableWebAppSupport (QString): false
externalEditorPath (QString): empty
fullyHighlightedBlockquotes (QString): false
gitCommitInterval (int): 30
gitExecutablePath (QString): empty
gitLogCommand (QString): empty
guiFirstRunInit (bool): true
ignoreAllExternalModifications (QString): false
ignoreAllExternalNoteFolderChanges (QString): false
ignoreNoteSubFolders (QString): ^\.
ignoredNoteFiles (QString): empty
imageScaleDown (QString): false
imageScaleDownMaximumHeight (int): 1024
imageScaleDownMaximumWidth (int): 1024
initialLayoutIdentifier (QString): full
insertTimeFormat (QString): empty
interfaceFontSize (int): 11
interfaceLanguage (QString): en
interfaceStyle (QString): Fusion
internalIconTheme (QString): false
itemHeight (int): 18
legacyLinking (QString): false
localTrash/autoCleanupDays (int): 30
localTrash/autoCleanupEnabled (QString): true
localTrash/supportEnabled (QString): true
markdownHighlightingEnabled (QString): true
maxNoteFileSize (int): 1048576
navigationPanelAutoSelect (QString): true
navigationPanelHideSearch (QString): false
networking/ignoreSSLErrors (QString): false
networking/proxyType (int): 2
newNoteAskHeadline (QString): false
noteEditIsCentralWidget (QString): true
noteFileExtensionList (QStringList): md, txt
noteListPreview (QString): false
noteSaveIntervalTime (int): 10
noteSubfoldersPanelDisplayAsFullTree (QString): true
noteSubfoldersPanelHideSearch (QString): false
noteSubfoldersPanelOrder (int): 0
noteSubfoldersPanelShowFullPath (QString): false
noteSubfoldersPanelShowNotesRecursively (QString): false
noteSubfoldersPanelShowRootFolderName (QString): true
noteSubfoldersPanelSort (int): 1
noteSubfoldersPanelTabsUnsetAllNotesSelection (QString): false
notesPanelOrder (int): 1
notesPanelSort (int): 1
notesPath (QString): C:/Users/admin/Notes
notifyAllExternalModifications (QString): false
overrideInterfaceFontSize (QString): false
ownCloud/supportEnabled (QString): false
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
restoreCursorPosition (QString): true
restoreLastNoteAtStartup (QString): true
restoreNoteTabs (QString): true
savedSearches/noteFolder-1 (QStringList): Note 2025-01-02T15.18.31, Note 2025-01-02T15.17.21
showMatches (QString): true
showMenuBar (bool): true
showStatusBar (bool): true
showStatusBarNotePath (QString): true
showStatusBarRelativeNotePath (QString): false
startInReadOnlyMode (QString): false
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): actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote
toolbar/1/name (QString): formattingToolbar
toolbar/1/title (QString): formatting toolbar
toolbar/2/items (QStringList): actionInsert_text_link, actionInsert_image, actionInsert_current_time
toolbar/2/name (QString): insertingToolbar
toolbar/2/title (QString): inserting toolbar
toolbar/3/items (QStringList): action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note
toolbar/3/name (QString): encryptionToolbar
toolbar/3/title (QString): encryption toolbar
toolbar/4/items (QStringList): actionEnable_AI, actionAiBackendComboBox, actionAiModelComboBox
toolbar/4/name (QString): aiToolbar
toolbar/4/title (QString): AI toolbar
toolbar/5/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/5/name (QString): windowToolbar
toolbar/5/title (QString): window toolbar
toolbar/6/items (QStringList): action_Quit
toolbar/6/name (QString): quitToolbar
toolbar/6/title (QString): quit 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/serverUrl (QString): wss://app.qownnotes.org
webAppClientService/token (QString): <hidden>
webSocketServerService/bookmarksNoteName (QString): empty
webSocketServerService/bookmarksTag (QString): bookmarks
webSocketServerService/commandSnippetsNoteName (QString): Commands
webSocketServerService/commandSnippetsTag (QString): commands
webSocketServerService/port (int): 22222
workspace-initial/name (QString): Full
workspace-initial/noteSubFolderDockWidgetVisible (QString): true
workspace-initial/windowState (QByteArray): <binary data>
workspaces (QStringList): initial

System environment

ALLUSERSPROFILE: C:\ProgramData
APPDATA: C:\Users\admin\AppData\Roaming
CommonProgramFiles: C:\Program Files\Common Files
CommonProgramFiles(x86): C:\Program Files (x86)\Common Files
CommonProgramW6432: C:\Program Files\Common Files
COMPUTERNAME: DESKTOP-D3BB1MV
ComSpec: C:\Windows\system32\cmd.exe
DriverData: C:\Windows\System32\Drivers\DriverData
HOMEDRIVE: C:
HOMEPATH: \Users\admin
LOCALAPPDATA: C:\Users\admin\AppData\Local
LOGONSERVER: \\DESKTOP-D3BB1MV
NUMBER_OF_PROCESSORS: 4
OS: Windows_NT
Path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\admin\AppData\Local\Microsoft\WindowsApps;
PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE: AMD64
PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
PROCESSOR_LEVEL: 6
PROCESSOR_REVISION: 8e0a
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\admin\AppData\Local\Temp
TMP: C:\Users\admin\AppData\Local\Temp
USERDOMAIN: DESKTOP-D3BB1MV
USERDOMAIN_ROAMINGPROFILE: DESKTOP-D3BB1MV
USERNAME: admin
USERPROFILE: C:\Users\admin
windir: C:\Windows


Do you have the same issue when running QOwnNotes in a new session (see cli-parameters)?

Yes, I also checked this with a clean session:

QOwnNotes --session test

@DemidovDG
Copy link
Author

I get a dialog that tells me that linked notes need to change...

I get this dialog window when I move note_2. However, when moving the note note_1, the dialog window does not appear.

I also tested this on Debian 12, and the behavior is the same.


It seems a bit convoluted to describe, but I hope you understand me. 😄

I also tried other options:

изображение

If I try to insert a link to the note as a regular file using file://, the situation becomes the opposite. Now, when moving note_1, the link to note_2 remains valid (because the path doesn't change). However, when moving note_2, the dialog window that should appear doesn't show up, and the link's path isn't updated. As a result, the link becomes invalid.

изображение

If I try to create a link using note://, everything works correctly during moves, and the link remains functional. However, there's another issue. When using note://, only the note's name is included, such as note://note_2, regardless of the subdirectory it is in. This creates a situation where I might have two notes with the same name in different subdirectories, for example, ./windows/bugs_note and ./linux/bugs_note. In this case, the link note://bugs_note will always point to one of these notes, and it won't be possible to specify which one I intended to reference.

изображение

@pbek
Copy link
Owner

pbek commented Jan 2, 2025

Ah, I see now. Currently, the mechanism only supports looking for notes that are linking to the moved note, not the other way around. This use case was more important, because you may not know anymore what linked to your note (meanwhile, you can also show the backlinks to notes). Would be a nice addition tho...

const QVector<int> noteIdList = oldNote.findLinkedNoteIds();

@pbek pbek added Importance: Medium Type: Improvement improves existing functionality and removed Type: Support labels Jan 2, 2025
@DemidovDG
Copy link
Author

I did some additional testing with different usage scenarios related to links and notes. I decided not to create another issue, as I think these are all part of the same problem: "broken links due to various actions with paths and notes".

To summarize, the link remains valid if:

  • ✔️ note_2 is moved
  • ✖️ note_1 is moved

It's also important to mention that if note_1 is moved first and then note_2 is moved, the mechanism will no longer work because the connection is already lost.

  • ✔️ note_2 is renamed
  • ✖️ Any directory in the path to note_2 is renamed

When a directory in the note's path is changed

qownnotes_test_2


Additionally, I wanted to mention that when note_2 is deleted, nothing happens. I think it would be helpful if a dialog window appeared before deleting the note, informing the user that there are still links pointing to it.

@pbek
Copy link
Owner

pbek commented Jan 2, 2025

It's also important to mention that if note_1 is moved first and then note_2 is moved, the mechanism will no longer work because the connection is already lost.

Yes, of course. There is no connection anymore.

Additionally, I wanted to mention that when note_2 is deleted, nothing happens. I think it would be helpful if a dialog window appeared before deleting the note, informing the user that there are still links pointing to it.

Currently, you can do that with the backlink panel.
You can create another feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Importance: Medium Type: Improvement improves existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants