Skip to content
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

Opening file with LaunchFileInfoAsync where path/filename contains space character #17301

Open
voidray opened this issue Oct 17, 2024 · 0 comments

Comments

@voidray
Copy link

voidray commented Oct 17, 2024

Describe the bug

When LaunchFileInfoAsync is used in Linux and the path/filename contains a space, then it fails, because the rest of the string after the space is interpreted as parameter.
xdg-open: unexpected argument 'rest-of-filename.txt'
Try 'xdg-open --help' for more information.

To Reproduce

Code:
var launcher = TopLevel.GetTopLevel(control).Launcher;
await launcher.LaunchFileInfoAsync(fileInfo); // fileInfo where the path or the filename contains a space character

Run under Linux

Workaround (used extra "" for filepath):
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Process.Start(new ProcessStartInfo(filePath) { UseShellExecute = true });
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
Process.Start(new ProcessStartInfo
{
FileName = "xdg-open",
Arguments = $""{filePath}"",
UseShellExecute = false,
CreateNoWindow = true
});
}

Expected behavior

Space characters should be supported.

Avalonia version

11.1.4

OS

Linux

Additional context

No response

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

No branches or pull requests

2 participants