signalapp / Signal-Desktop

A private messenger for Windows, macOS, and Linux.
https://signal.org/download
GNU Affero General Public License v3.0
14.68k stars 2.68k forks source link

[Linux - Plasma6 - KDialog] Filename not autofilled in "save as..."-dialog #7061

Closed dominikegert closed 1 month ago

dominikegert commented 1 month ago

Using a supported version?

Overall summary

When receiving a file, iE a pdf. - Clicking on it will open the "Save" dialog, but neither file extension, nor filename are carried over. - I have to type the name myself.

Steps to reproduce

  1. Go to any chat
  2. Try to open a received file
  3. look at the "Save" dialog

Expected result

The filename should be carried over to the "Save" dialog

Actual result

The filename is not being carried over.

Screenshots

No response

Signal version

7.29.0

Operating system

Arch Linux 64-bit

Version of Signal on your phone

7.19.2

Link to debug log

https://debuglogs.org/desktop/7.29.0/b45b947b773745410a446c978eb04da293b89fc39302d596420bb52b4d6ba480.gz

jamiebuilds-signal commented 1 month ago

This is likely an issue in the framework we use Electron. I'm not able to reproduce the issue likely because of OS differences. But if you wanted to report it back to Electron, the first step would be to see if you can reproduce it more minimally.

You can download the Electron Fiddle app and load this fiddle I've started for you: https://gist.github.com/beb77598fa7c7f3ad843fa32b359fa73. If you click "Run" you can see how the app behaves on your operating system.

I'm going to close this since I can't reproduce it

StagnationPoint commented 1 month ago

FYI I can repro this on Kubuntu 24.04. @jamiebuilds-signal, what distro are you using?

dominikegert commented 1 month ago

Here my details:

Operating System: Arch Linux KDE Plasma Version: 6.2.1 KDE Frameworks Version: 6.7.0 Qt Version: 6.8.0 Kernel Version: 6.9.8-1-clear (64-bit) Graphics Platform: Wayland Processors: 20 × 12th Gen Intel® Core™ i7-12700K Memory: 15,4 GiB of RAM Graphics Processor: AMD Radeon RX 7900 XT Manufacturer: Gigabyte Technology Co., Ltd. Product Name: Z790 UD

dominikegert commented 1 month ago

If I understand this correctly, your posted fiddle opens a dialog to select a file. - But how is this the same as if I would want to save a file, and want the dialog to receive that filename, which was given in the message from signal-chat?

What would I report to electron project, can you point me into the correct direction here, maybe?

This is likely an issue in the framework we use Electron. I'm not able to reproduce the issue likely because of OS differences. But if you wanted to report it back to Electron, the first step would be to see if you can reproduce it more minimally.

You can download the Electron Fiddle app and load this fiddle I've started for you: https://gist.github.com/beb77598fa7c7f3ad843fa32b359fa73. If you click "Run" you can see how the app behaves on your operating system.

I'm going to close this since I can't reproduce it

dominikegert commented 1 month ago

I have fiddled a bit with what you have provided and I come up to the conclusion, it should be something along these lines, or am I off charts here??

async function main() {
  // Wait until the app is ready
  await app.whenReady()

  **const options = {
    defaultPath: app.getPath('documents') + '/electron-tutorial-app.pdf',
  }

  // Show a dialog to select a file
  const opened = await dialog.showSaveDialog(null, options, (path) => {console.log(Path);})**

  // Stop the dialog was closed without selecting a file
  if (opened.canceled) return

  // Get the selected file path
  const [filePath] = opened.filePaths

  // Get the selected file name ("/path/to/file.txt" -> "file.txt")
  const fileName = path.basename(filePath)

  // Show a dialog to save 
  await dialog.showSaveDialog({ defaultPath: fileName })

  // Goodbye
  app.quit()
}
jamiebuilds-signal commented 1 month ago

@dominikegert Sorry yes it seems like you could simplify the code even more then:

const { app, BrowserWindow, dialog } = require('electron')

async function main() {
  // Wait until the app is ready
  await app.whenReady()

  // Create a new window
  const window = new BrowserWindow()

  // Show a dialog to save a file
  await dialog.showSaveDialog(window, { defaultPath: 'example.pdf' })

  // Goodbye
  app.quit()
}

main()

Fiddle: https://gist.github.com/b4798bed4fa77f0c62947534c7738fab

This is a screenshot from macOS (Not at my other computer for the moment):

Screenshot 2024-10-23 at 7 04 02 AM

When you open this updated fiddle are you not seeing "example.pdf" in the default file name?

dominikegert commented 1 month ago

Actually I am not...

Take a look: image

dominikegert commented 1 month ago

I have reported a bug on electron project https://github.com/electron/electron/issues/44390