Skip to content

fix: wrong escaping on xdg-open (linux) - #21936

Merged
MrJul merged 1 commit into
AvaloniaUI:mainfrom
ReinaS-64892:wrong-escaping
Aug 12, 2026
Merged

MrJul merged 1 commit into
AvaloniaUI:mainfrom
ReinaS-64892:wrong-escaping

Conversation

@ReinaS-64892

Copy link
Copy Markdown
Contributor

What does the pull request do?

This PR resolves the issue described in #20230.

What is the current behavior?

(Based on what I encountered) An unnecessary \ is added before the # character, causing the attempt to open a directory containing # to fail.

More detailed information can be found here: #20230 (comment)

What is the updated/expected behavior with this PR?

The URI (file path, URL, etc.) is passed directly as an argument to xdg-open, allowing directories containing # to be opened successfully.

How was the solution implemented (if it's not obvious)?

(This is likely quite straightforward, but for the sake of clarity:)

Just like the macOS implementation, the arguments are passed directly to xdg-open (i.e., without any escaping).

Furthermore, the reason I didn't use the fix described in the additional information for Issue #20230 is that writing the code in a format similar to that for macOS eliminates the need for additional functions and avoids calling /bin/sh, which is of unclear necessity.

Checklist

Breaking changes

None

Obsoletions / Deprecations

None

Fixed issues

Fixes #20230

The Japanese original text before machine translation

What does the pull request do?

#20230 の問題を解決するものです。

What is the current behavior?

(私が直面した範囲では)# の前に不必要な \ が追加され、#を含むディレクトリを開くことに失敗します。

こちらのほうがより詳細な情報があると思います : #20230 (comment)

What is the updated/expected behavior with this PR?

そのまま xdg-open の引数に URI (ファイルパスや URLなど) が送られ、正常に # を含むディレクトリを開くことが出来ること。

How was the solution implemented (if it's not obvious)?

(かなり愚直でわかりやすいと思いますが一応)

macos 向けのコードのように、引数をそのまま(つまり一切のエスケープ無しで) xdg-open の引数に渡るようにしています。

また、Issue #20230 の方に追加情報にある修正方法を使用しなかった理由は、 macos 向けのコードのような形にしたほうが、追加の関数も必要無く、必要性の不明な /bin/sh を呼び出しを回避できるからです。

@MrJul MrJul added bug os-linux backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Aug 7, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0068184-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@cla-avalonia

cla-avalonia commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator
  • All contributors have signed the CLA.

@ReinaS-64892

Copy link
Copy Markdown
Contributor Author

@cla-avalonia agree

@MrJul MrJul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@MrJul
MrJul added this pull request to the merge queue Aug 12, 2026
Merged via the queue into AvaloniaUI:main with commit 2e7da1d Aug 12, 2026
10 checks passed
@ReinaS-64892
ReinaS-64892 deleted the wrong-escaping branch August 12, 2026 13:53
MrJul pushed a commit to MrJul/Avalonia that referenced this pull request Sep 2, 2026
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ILauncher on Linux can create and launch malformed urls due to escaping

4 participants