Fix Quick Access Links of type File ignoring custom name in search results#4354
Conversation
Co-authored-by: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com>
|
🥷 Code experts: Jack251970 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThis change adds support for custom file names in Quick Access Links search results by introducing an optional Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can approve the review once all CodeRabbit's comments are resolved.Enable the |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs`:
- Line 288: The title assignment treats empty or whitespace-only name as valid;
update the fallback to use string.IsNullOrWhiteSpace so blank names fall back to
the filename. Replace the current expression that sets title (var title = name
?? Path.GetFileName(filePath) ?? string.Empty;) with a conditional using
string.IsNullOrWhiteSpace(name) (e.g., var title =
string.IsNullOrWhiteSpace(name) ? Path.GetFileName(filePath) ?? string.Empty :
name.Trim(); ) so that null/empty/whitespace names use
Path.GetFileName(filePath) and non-empty names are trimmed and used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d5f7f1c6-c608-43d1-95ca-b29ee00f74ce
📒 Files selected for processing (2)
Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.csPlugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
| { | ||
| var isMedia = IsMedia(Path.GetExtension(filePath)); | ||
| var title = Path.GetFileName(filePath) ?? string.Empty; | ||
| var title = name ?? Path.GetFileName(filePath) ?? string.Empty; |
There was a problem hiding this comment.
Handle empty custom names in fallback logic.
On Line 288, an empty/whitespace name is treated as a valid title, which can render blank file result titles. Fallback should apply for null and empty/whitespace values.
Suggested fix
- var title = name ?? Path.GetFileName(filePath) ?? string.Empty;
+ var title = string.IsNullOrWhiteSpace(name)
+ ? (Path.GetFileName(filePath) ?? string.Empty)
+ : name;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs` at line 288,
The title assignment treats empty or whitespace-only name as valid; update the
fallback to use string.IsNullOrWhiteSpace so blank names fall back to the
filename. Replace the current expression that sets title (var title = name ??
Path.GetFileName(filePath) ?? string.Empty;) with a conditional using
string.IsNullOrWhiteSpace(name) (e.g., var title =
string.IsNullOrWhiteSpace(name) ? Path.GetFileName(filePath) ?? string.Empty :
name.Trim(); ) so that null/empty/whitespace names use
Path.GetFileName(filePath) and non-empty names are trimmed and used.
…links-names Fix Quick Access Links of type File ignoring custom name in search results
Fixes #3772
Summary by cubic
Summary of changes
Fixes file-type Quick Access Links ignoring custom names by passing the saved link name into
ResultManager.CreateFileResult, so search results display the custom title.QuickAccess.AccessLinkListMatchedandAccessLinkListAllnow callCreateFileResult(..., name: l.Name)forResultType.File.ResultManager.CreateFileResultaccepts an optionalstring nameand uses it for the result title; falls back toPath.GetFileName(filePath)when not provided.Written for commit d0c30df. Summary will update on new commits.