-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DirectoryDAO: Fix file path matching when relocating directories #4146
Conversation
The SQL string quote character ' in path names needs to be escaped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thank you.
@vonzimr Can you confirm that his one is working? |
The scope of |
Tests on Windows are fixed after fixing the build. |
Ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to test this, but the code looks good to me.
src/library/dao/directorydao.cpp
Outdated
DEBUG_ASSERT(!oldFolder.endsWith('/')); | ||
const QString oldFolderPrefix = oldFolder + '/'; | ||
const QString startsWithOldFolder = SqlLikeWildcardEscaper::apply( | ||
oldFolderPrefix, kSqlLikeMatchAll) + | ||
kSqlLikeMatchAll; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code is duplicated in TrackDAO
. Should this be moved into a utility function?
Also, please use the term "directory" instead of "folder". "Folder" is used on windows because it displays stuff as "Folders" in the WIndows Explorer. And the Control Panel or the Network Neighborhood are folders, but not directories. We are referring to the file system here, so directory is the correct term. /smartass-mode off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have decided to keep the existing names to minimize the changes. But we could rename the variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not that important, but it would be good to keep it in mind for new code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escape character must match the following SQL query. This gets lost when moving the code into a function. Not really helpful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, I am not going to write any new database code in C++ ;) Only inevitable bug fixes.
Alright, let's wait for CI, then we can merge IMHO. |
CI passed so I went ahead and merged. |
I'll merge to main, non-trivial conflicts as expected. |
CHANGELOG: Fix relocation of directories with special/reserved characters in path name