Skip to content

Fix songs getting removed from collection when new ones are added

Tuomas Nurmi requested to merge nurmi/amarok:sqlTestImprovements into master

After three days of debugging, refreshing related autotests, writing more tests, hunting for differences between autotest mock components and real ones and digging deep into database queries related to saving paths, I am happy to announce that I have a fix which changes a single _ [SQL wildcard character] to /. This way, wrong directories are not accidentally matched as changed, and removed from collection as they didn't appear in the latest partial scan that went through the changed ones.

I guess the original idea in the code might have been to handle both unix and windows path separators. However, based on my digging, I think Qt does that anyhow in every case before anything is written to db. Also, the directories saved into db always come from MountPointManager's getRelativePath, which has never a trailing /, so the slash instead of underscore should always be a correct character here to match subdirectories.

Additionally, make SqlMountPointManagerMock's absolute and relative paths correspond better to those of MountPointManager. This bug was not reproducible with the newly added partial scan test before the path generation was edited.

BUG: 475528

Merge request reports