Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Always open browser bookmarks in browser#4548

Open
DavidGBrett wants to merge 2 commits into
dev from
browser-bookmark-url-scheme-fix
Open

Always open browser bookmarks in browser #4548
DavidGBrett wants to merge 2 commits into
dev from
browser-bookmark-url-scheme-fix

Conversation

@DavidGBrett

@DavidGBrett DavidGBrett commented Jun 25, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Use OpenWebUrl instead of OpenUrl in Browser Bookmark plugin - all bookmarks coming from a browser should be opened in a browser. This means schemes like chrome:// will also be supported now in bookmarks.

Also extracted out the result creation to its own method as it was mostly duplicated code.

Summary by cubic

Bookmarks now always open in your default browser, including browser-specific URLs like chrome://. Also refactors bookmark result creation to a single helper for consistency.

Summary of changes

  • Changed: Use OpenWebUrl to open bookmarks so browser-specific schemes (e.g., chrome://, edge://, about:) work.
  • Added: Helper method to build bookmark results, centralizing icon, score, and action logic.
  • Removed: Duplicate inline result creation in two code paths.
  • Memory: No meaningful impact; minor reduction in transient allocations due to refactor.
  • Security: Low risk; links open in the browser only, and still originate from user bookmarks.
  • Tests: No unit tests added; behavior verified manually.

Release Note
Opening bookmarks now always uses your browser and supports special browser pages like Settings.

Written for commit 05880da. Summary will update on new commits.

Review in cubic

Any url from a browser bookmark should certainly be opened with a browser
This means it will now support urls like chrome://settings as OpenUrl only passed http/https urls to the browser
@github-actions github-actions Bot added this to the 2.2.0 milestone Jun 25, 2026
@DavidGBrett DavidGBrett marked this pull request as ready for review June 25, 2026 18:19

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

coderabbitai Bot commented Jun 25, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Query now creates bookmark results through a helper that maps fields and defines the action. The top-results branch computes score separately, and the fallback branch still uses score 5. The bookmark action now opens the URL with OpenWebUrl.

Changes

Bookmark result construction

Layer / File(s) Summary
Result helper and action update
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs
Query now builds bookmark results through a helper that assigns Title, SubTitle, IcoPath, Score, ContextData, and Action, and the action now calls OpenWebUrl.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: bookmarks now open in the browser.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description matches the code changes, covering OpenWebUrl usage and the bookmark result-creation refactor.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch browser-bookmark-url-scheme-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs`:
- Around line 118-122: The bookmark action handler in Main.cs can throw when
Context.API.OpenWebUrl receives a null, relative, or malformed bookmark.Url.
Update the Action callback for the bookmark item to wrap the OpenWebUrl call in
a try-catch, catch the URI parsing failure, and log the error instead of letting
the exception escape. Use the existing bookmark.Url and Context.API.OpenWebUrl
symbols to locate the handler and keep the failure path graceful.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

i️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 795f8b44-4716-4111-be3b-e1d7d2043264

📥 Commits

Reviewing files that changed from the base of the PR and between 5413d40 and 05880da.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Comment on lines +118 to +122
Action = _ =>
{
Context.API.OpenWebUrl(bookmark.Url);
return true;
},

@coderabbitai coderabbitai Bot Jun 25, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -nP -C4 '\bpublic void OpenUrl\b' --type=cs

Repository: Flow-Launcher/Flow.Launcher

Length of output: 165


Guard against malformed bookmark URLs in action handler

Context.API.OpenWebUrl internally instantiates new Uri(url), which throws UriFormatException for null, relative, or malformed URLs. Since bookmark.Url is untrusted user data, the current action handler lacks protection, causing an uncaught exception if a bookmark is corrupt. Wrap the call in a try-catch to gracefully handle failures and log the error.

Recommended change
 Action = _ =>
 {
- Context.API.OpenWebUrl(bookmark.Url);
- return true;
+ try
+ {
+ Context.API.OpenWebUrl(bookmark.Url);
+ return true;
+ }
+ catch (Exception e)
+ {
+ // Log the malformed URL and return false to hide the exception from the user
+ Context.API.LogException("BrowserBookmark", $"Failed to open bookmark: {bookmark.Url}", e);
+ return false;
+ }
 },
📝 Committable suggestion

!!️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Action = _ =>
{
Context.API.OpenWebUrl(bookmark.Url);
return true;
},
Action = _ =>
{
try
{
Context.API.OpenWebUrl(bookmark.Url);
return true;
}
catch (Exception e)
{
// Log the malformed URL and return false to hide the exception from the user
Context.API.LogException("BrowserBookmark", $"Failed to open bookmark: {bookmark.Url}", e);
return false;
}
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs` around lines 118 - 122,
The bookmark action handler in Main.cs can throw when Context.API.OpenWebUrl
receives a null, relative, or malformed bookmark.Url. Update the Action callback
for the bookmark item to wrap the OpenWebUrl call in a try-catch, catch the URI
parsing failure, and log the error instead of letting the exception escape. Use
the existing bookmark.Url and Context.API.OpenWebUrl symbols to locate the
handler and keep the failure path graceful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@cubic-dev-ai cubic-dev-ai[bot] cubic-dev-ai[bot] left review comments

At least 1 approving review is required to merge this pull request.

Labels

Code Refactor enhancement New feature or request

Projects

None yet

Milestone

2.2.0

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /