Skip to content

Conversation

@asjqkkkk
Copy link
Collaborator

@asjqkkkk asjqkkkk commented Jun 17, 2025

To fix #8050

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Summary by Sourcery

Refine URL handling to prevent unintentional protocol prepending for custom editor URLs on Windows while preserving scheme addition for standard links on Linux and Android.

Bug Fixes:

  • Skip adding default protocol to custom URLs on Windows to restore correct link launching behavior.

Enhancements:

  • Refine URL launcher logic by introducing a Windows-specific custom URL check with isCustomUrL.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jun 17, 2025

Reviewer's Guide

Refines the URL launch helper to prevent automatic HTTP scheme prepending for custom or non-standard URLs on Windows by leveraging the existing custom URL detector.

File-Level Changes

Change Details Files
Exclude Windows custom/non-standard URLs from HTTP scheme prepending
  • Imported isCustomUrL helper from editor util
  • Removed Windows from the broad scheme-prepend condition
  • Added isNotCustomUrlOnWindows flag combining Windows and non-custom URL check
  • Updated conditional to use the new flag for scheme prepending
frontend/appflowy_flutter/lib/core/helpers/url_launcher.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#8050 The application should open non-standard URLs (e.g., obsidian://) without prepending 'https://'.
#8050 The fix should apply to Windows 10.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @asjqkkkk - I've reviewed your changes - here's some feedback:

  • There’s a typo in the variable name isNotCustomUrlOnWidows—it should be isNotCustomUrlOnWindows for clarity.
  • Importing isCustomUrL from appflowy_editor/src couples you to an internal API; consider exposing it publicly or replicating just the necessary logic here.
  • Update the comment above the platform check to accurately reflect the Windows exception instead of still listing Windows alongside Linux/Android.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There’s a typo in the variable name `isNotCustomUrlOnWidows`—it should be `isNotCustomUrlOnWindows` for clarity.
- Importing `isCustomUrL` from `appflowy_editor/src` couples you to an internal API; consider exposing it publicly or replicating just the necessary logic here.
- Update the comment above the platform check to accurately reflect the Windows exception instead of still listing Windows alongside Linux/Android.

## Individual Comments

### Comment 1
<location> `frontend/appflowy_flutter/lib/core/helpers/url_launcher.dart:46` </location>
<code_context>

-  // on Linux or Android or Windows, add http scheme to the url if it is not present
+  // on Linux or Android, add http scheme to the url if it is not present
+  final isNotCustomUrlOnWidows =
+      UniversalPlatform.isWindows && !isCustomUrL(url);
   if ((UniversalPlatform.isLinux ||
</code_context>

<issue_to_address>
Typo in variable name

Please rename `isNotCustomUrlOnWidows` to `isNotCustomUrlOnWindows`.
</issue_to_address>

### Comment 2
<location> `frontend/appflowy_flutter/lib/core/helpers/url_launcher.dart:45` </location>
<code_context>
   }

-  // on Linux or Android or Windows, add http scheme to the url if it is not present
+  // on Linux or Android, add http scheme to the url if it is not present
+  final isNotCustomUrlOnWidows =
+      UniversalPlatform.isWindows && !isCustomUrL(url);
</code_context>

<issue_to_address>
Comment doesn’t reflect Windows condition

Please update the comment to include Windows, as the logic applies to Windows when the URL is not custom.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

}

// on Linux or Android or Windows, add http scheme to the url if it is not present
// on Linux or Android, add http scheme to the url if it is not present
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Comment doesn’t reflect Windows condition

Please update the comment to include Windows, as the logic applies to Windows when the URL is not custom.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Regression in handling on non-standard URLs / URIs

1 participant