Skip to content

Commit

Permalink
fix: remove redundant path check in TagDirIterator
Browse files Browse the repository at this point in the history
Remove unnecessary path validation in TagDirIterator::loadTagsUrls():
- Remove check for "/home/" prefix
- Remove check for "/media/" prefix
- Remove TODO comment about SQL path handling

The path validation was redundant since:
1. File existence is already checked later
2. All valid paths should be allowed for tagging
3. The path restriction was artificially limiting functionality

Log:

Bug: https://pms.uniontech.com/bug-view-293709.html
  • Loading branch information
Johnson-zs committed Dec 12, 2024
1 parent 5cf844c commit efcb16c
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ void TagDirIteratorPrivate::loadTagsUrls(const QUrl &url)
QStringList pathList = TagManager::instance()->getFilesByTag(tagName);

for (const QString &path : pathList) {
QUrl tagUrl;
// TODO(liuyangming): handle path in sql
if (!path.startsWith("/home/")
&& !path.startsWith(FileUtils::bindPathTransform("/home/", true))
&& !path.startsWith("/media/"))
continue;

tagUrl = QUrl::fromLocalFile(path);

QUrl tagUrl = QUrl::fromLocalFile(path);
const FileInfoPointer &info = InfoFactory::create<FileInfo>(tagUrl);
if (!info->exists())
continue;
Expand Down

0 comments on commit efcb16c

Please sign in to comment.