Skip to content

Remove the last \\ or / in path if it exists because it can cause path type checking issues #3778

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

Closed
wants to merge 3 commits into from

Conversation

Jack251970
Copy link
Member

Remove the last \ or / in path if it exists because it can cause path type checking issues

Resolve #3777.

@Jack251970 Jack251970 requested a review from Copilot June 27, 2025 02:29
@Jack251970 Jack251970 self-assigned this Jun 27, 2025
@Jack251970 Jack251970 added the bug Something isn't working label Jun 27, 2025
@Jack251970 Jack251970 added this to the 2.0.0 milestone Jun 27, 2025
@Jack251970 Jack251970 enabled auto-merge June 27, 2025 02:29
Copilot

This comment was marked as outdated.

Copy link

gitstream-cm bot commented Jun 27, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 126 additions & 93 deletions 37 additions & 11 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 50%

To learn more about /:\ gitStream - Visit our Docs

1 similar comment
Copy link

gitstream-cm bot commented Jun 27, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970, onesounds have most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs

Activity based on git-commit:

Jack251970 onesounds
JUN 126 additions & 93 deletions 37 additions & 11 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 50%

To learn more about /:\ gitStream - Visit our Docs

Copy link

gitstream-cm bot commented Jun 27, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

1 similar comment
Copy link

gitstream-cm bot commented Jun 27, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

coderabbitai bot commented Jun 27, 2025

📝 Walkthrough

"""

Walkthrough

The code refactors the path selection logic in the Quick Access Link settings for the Explorer plugin. It introduces a local variable to store the selected path, validates it, trims trailing directory separators using Path.TrimEndingDirectorySeparator, and then assigns it to the relevant property, ensuring correct handling of both file and folder paths.

Changes

File(s) Change Summary
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs Refactored SelectPath_OnClick to use a local variable for path selection, added trimming of trailing directory separators before assignment.

Assessment against linked issues

Objective Addressed Explanation
Correct handling of file paths in Quick Access Links, ensuring type remains 'File' and paths are not incorrectly treated as folders (#3777)

Suggested reviewers

  • cibere
  • taooceros
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebe4069 and e05809d.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream workflow automation
  • GitHub Check: Report (PR)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b183298 and ebe4069.

📒 Files selected for processing (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:34:24.926Z
Learning: In Windows Forms dialogs, Windows handles invalid paths and prevents the user from clicking "Ok" if the path is incorrect, so additional path validation is unnecessary.
Learnt from: NoPlagiarism
PR: Flow-Launcher/Flow.Launcher#3104
File: Flow.Launcher.Plugin/Result.cs:73-74
Timestamp: 2024-12-02T07:37:46.838Z
Learning: In 'Result.cs', the user prefers not to add additional data URI validation in the 'IcoPath' property setter.
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (5)
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Yusyuriv
PR: Flow-Launcher/Flow.Launcher#3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:34:24.926Z
Learning: In Windows Forms dialogs, Windows handles invalid paths and prevents the user from clicking "Ok" if the path is incorrect, so additional path validation is unnecessary.
Learnt from: Koisu-unavailable
PR: Flow-Launcher/Flow.Launcher#3770
File: Flow.Launcher/ViewModel/MainViewModel.cs:0-0
Timestamp: 2025-06-24T19:06:48.344Z
Learning: In Flow.Launcher's Explorer plugin results, the SubTitle property always contains the directory containing the file. For file results, Title contains the filename and SubTitle contains the parent directory. For directory results, SubTitle contains the directory path itself.
Learnt from: NoPlagiarism
PR: Flow-Launcher/Flow.Launcher#3104
File: Flow.Launcher.Plugin/Result.cs:73-74
Timestamp: 2024-12-02T07:37:46.838Z
Learning: In 'Result.cs', the user prefers not to add additional data URI validation in the 'IcoPath' property setter.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs (1)

171-172: LGTM: Path trimming logic correctly addresses the stated issue.

The use of TrimEnd('\\', '/') appropriately removes trailing backslashes and forward slashes, which aligns with the PR objective to fix path type checking issues. The comments clearly explain the purpose.

Also applies to: 187-188

@Jack251970 Jack251970 requested a review from Copilot June 27, 2025 02:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses path type checking issues by ensuring that any trailing directory separators in the selected paths are removed.

  • Update file selection functionality to trim trailing slashes
  • Update folder selection functionality to trim trailing slashes
  • Add the required System.IO reference for the new method usage

@@ -167,7 +168,8 @@ private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
string.IsNullOrEmpty(openFileDialog.FileName))
return;

SelectedPath = openFileDialog.FileName;
Copy link
Member

Choose a reason for hiding this comment

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

This seems to come from the windows dialogue control, why does it have slash for a filename path? Have you tested this resolves the issue?

@Jack251970
Copy link
Member Author

Jack251970 commented Jun 27, 2025 via email

@jjw24
Copy link
Member

jjw24 commented Jun 27, 2025

might be worth double checking, doesnt seem like it's the right fix.

@Jack251970
Copy link
Member Author

might be worth double checking, doesnt seem like it's the right fix.

I can sure it is the reason that causes this issue. If one file is appended with \, the type of it will be wrong!
image

@Jack251970 Jack251970 closed this Jul 8, 2025
auto-merge was automatically disabled July 8, 2025 01:42

Pull request was closed

@Jack251970 Jack251970 deleted the quick_access_link_character branch July 8, 2025 01:42
@Jack251970 Jack251970 removed this from the 2.0.0 milestone Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: Explorer plugin doesn't allow adding file in Quick Access Links
2 participants