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

Fix: Display tags on network drives when selecting tag #12420

Merged
merged 2 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/Files.App/Filesystem/Search/FolderSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,16 @@ public Task SearchAsync(IList<ListedItem> results, CancellationToken token)

private async Task AddItemsAsyncForHome(IList<ListedItem> results, CancellationToken token)
{
foreach (var drive in drivesViewModel.Drives.Cast<DriveItem>().Where(x => !x.IsNetwork))
if (AQSQuery.StartsWith("tag:", StringComparison.Ordinal))
{
await SearchTagsAsync("", results, token); // Search tags everywhere, not only local drives
}
else
{
await AddItemsAsync(drive.Path, results, token);
foreach (var drive in drivesViewModel.Drives.Cast<DriveItem>().Where(x => !x.IsNetwork))
{
await AddItemsAsync(drive.Path, results, token);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Files.Shared/FileTagsDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public IEnumerable<TaggedFile> GetAll()
public IEnumerable<TaggedFile> GetAllUnderPath(string folderPath)
{
var col = db.GetCollection<TaggedFile>(TaggedFiles);
if (string.IsNullOrEmpty(folderPath))
return col.FindAll();
return col.Find(x => x.FilePath.StartsWith(folderPath, StringComparison.OrdinalIgnoreCase));
}

Expand Down