Description
Bug Report: Cannot Open Empty Files in File Browser
Description
When attempting to open a newly created, empty file (e.g., compose.yml
created with touch
) from the XPipe file browser, an error occurs, and the file is not opened. The error message indicates an issue with finding a default application for the application/x-zerosize
content type. This suggests that XPipe's file opening mechanism, particularly when delegating to the system's default application, struggles with files that have a size of zero bytes.
Steps to Reproduce
- Connect to a remote server using XPipe.
- Navigate to any directory in the XPipe file browser.
- Create an empty file on the remote server, for example, by running
touch compose.yml
in a terminal. - In the XPipe file browser, locate the newly created
compose.yml
file. - Attempt to open the
compose.yml
file (e.g., by double-clicking it or using the "Open in Default Application" action from the context menu).
Expected Behavior
The empty file should open successfully in the default application configured on the remote system (e.g., a text editor), or XPipe's internal editor if applicable, without any errors. Empty files are valid and should be viewable.
Actual Behavior
An error dialog appears, and the file fails to open. The error message specifically mentions Failed to find default application for content type ‘application/x-zerosize’
, indicating that the system's gio
utility (used for opening files) cannot determine a suitable application for zero-byte files.
Error Message
Unable to open file /tmp/xpipe/bannert/bridge/f99150/compose.yml
Process returned exit code 4:
gio: file:///tmp/xpipe/bannert/bridge/f99150/compose.yml: Failed to find default application for content type ‘application/x-zerosize’
Stacktrace
io.xpipe.core.process.ProcessOutputException: Process returned exit code 4:
gio: file:///tmp/xpipe/bannert/bridge/f99150/compose.yml: Failed to find default application for content type ‘application/x-zerosize’
at io.xpipe.core.process.ProcessOutputException.of(ProcessOutputException.java:59)
at io.xpipe.ext.proc.a.a(SourceFile:357)
at io.xpipe.ext.proc.a.discardOrThrow(SourceFile:229)
at io.xpipe.core.process.ShellControl.executeSimpleCommand(ShellControl.java:174)
at io.xpipe.app.util.FileOpener.openInDefaultApplication(FileOpener.java:79)
at io.xpipe.app.browser.file.BrowserFileOpener.lambda$openInDefaultApplication$2(BrowserFileOpener.java:162)
at io.xpipe.app.util.FileBridge.openIO(FileBridge.java:170)
at io.xpipe.app.browser.file.BrowserFileOpener.openInDefaultApplication(BrowserFileOpener.java:148)
at io.xpipe.ext.base.browser.OpenFileDefaultAction.execute(OpenFileDefaultAction.java:25)
at io.xpipe.app.browser.action.BrowserLeafAction.lambda$toMenuItem$3(BrowserLeafAction.java:88)
at io.xpipe.app.util.BooleanScope.executeExclusive(BooleanScope.java:22)
at io.xpipe.app.browser.action.BrowserLeafAction.lambda$toMenuItem$2(BrowserLeafAction.java:81)
at io.xpipe.app.util.ThreadHelper.lambda$runFailableAsync$0(ThreadHelper.java:45)
at io.xpipe.app.util.ThreadHelper.lambda$wrap$0(ThreadHelper.java:22)
at java.lang.VirtualThread.run(VirtualThread.java:466)