Skip to content

Commit 4ea05b3

Browse files
authored
Fix: Display tags on network drives when selecting tag (#12420)
1 parent 271a416 commit 4ea05b3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Files.App/Filesystem/Search/FolderSearch.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,16 @@ public Task SearchAsync(IList<ListedItem> results, CancellationToken token)
111111

112112
private async Task AddItemsAsyncForHome(IList<ListedItem> results, CancellationToken token)
113113
{
114-
foreach (var drive in drivesViewModel.Drives.Cast<DriveItem>().Where(x => !x.IsNetwork))
114+
if (AQSQuery.StartsWith("tag:", StringComparison.Ordinal))
115+
{
116+
await SearchTagsAsync("", results, token); // Search tags everywhere, not only local drives
117+
}
118+
else
115119
{
116-
await AddItemsAsync(drive.Path, results, token);
120+
foreach (var drive in drivesViewModel.Drives.Cast<DriveItem>().Where(x => !x.IsNetwork))
121+
{
122+
await AddItemsAsync(drive.Path, results, token);
123+
}
117124
}
118125
}
119126

src/Files.Shared/FileTagsDb.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public IEnumerable<TaggedFile> GetAll()
160160
public IEnumerable<TaggedFile> GetAllUnderPath(string folderPath)
161161
{
162162
var col = db.GetCollection<TaggedFile>(TaggedFiles);
163+
if (string.IsNullOrEmpty(folderPath))
164+
return col.FindAll();
163165
return col.Find(x => x.FilePath.StartsWith(folderPath, StringComparison.OrdinalIgnoreCase));
164166
}
165167

0 commit comments

Comments
 (0)