desktop icon indicating copy to clipboard operation
desktop copied to clipboard

[Bug]: Downloading an SVG leads to error "Failed to get thumbnail from local thumbnail cache reference"

Open bjoernmartin opened this issue 1 year ago • 10 comments

Checks before filing an issue

  • [X] This issue doesn't reproduce on web browsers (such as in Chrome). If it does, issue reports go to the Mattermost Server repository.
  • [X] I have checked the issue tracker and have not found an issue that matches the one I'm filing.
  • [X] This issue is not a troubleshooting question. Troubleshooting questions go here: https://forum.mattermost.com/c/trouble-shoot/16.
  • [X] This issue is not a feature request. You can request features and make product suggestions here: https://mattermost.com/suggestions/.
  • [X] This issue reproduces on the most recent stable version, or the most recent prerelease version of the Mattermost Desktop App.
  • [X] I have read the contribution guidelines.

Mattermost Desktop Version

5.9.0

Operating System

Windows 11 x64

Mattermost Server Version

EE 9.5.6

Steps to reproduce

  • Navigate to a chat with SVG images attached
  • Click on the Download icon of that SVG image

image

Expected behavior

  • SVG is successfully downloaded
  • No error message is shown and Mattermost does not need to restart

Observed behavior

  • SVG is successfully downloaded (yes, actual download works)
  • An error message is shown (see below) and Mattermost has to be restarted

image

Log Output

Application: Mattermost 5.9.0
Platform: Windows_NT 10.0.22631 x64
Error: Failed to get thumbnail from local thumbnail cache reference
    at C.formatDownloadItem (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:258206)
    at C.upsertFileToDownloads (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:255614)
    at C.doneEventController (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:256970)
    at DownloadItem.<anonymous> (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:254776)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

Additional Information

  • Tested on the web interface (current Firefox) and the issue does not show up there.
  • Downloading a different file type (JSON) works, no issues.
  • Downloading an image (PNG) works as well. But here the UX is different, as I first have to click on the image to show it and, when it's shown, I can click the download button shown at the top-right.

bjoernmartin avatar Sep 03 '24 09:09 bjoernmartin

My Desktop Mattermost crash too when I try to download a png or jpeg file but the error is different, I don't know if this is related to the same issue.

I'm on Manjaro with kernel 6.10 Mattermost 5.9.0 Desktop

Application: Mattermost 5.9.0 [commit: 5.9.0]
Platform: Linux 6.10.6-10-MANJARO x64
TypeError: s.nativeImage.createThumbnailFromPath is not a function
    at C.formatDownloadItem (/usr/lib/mattermost-desktop/app.asar/index.js:2:258337)
    at C.upsertFileToDownloads (/usr/lib/mattermost-desktop/app.asar/index.js:2:255745)
    at C.doneEventController (/usr/lib/mattermost-desktop/app.asar/index.js:2:257101)
    at DownloadItem.<anonymous> (/usr/lib/mattermost-desktop/app.asar/index.js:2:254907)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

dragonis41 avatar Sep 03 '24 16:09 dragonis41

The same error appears when downloading *.dwg file.

zwolinski avatar Sep 04 '24 07:09 zwolinski

+1

s.nativeImage.createThumbnailFromPath is not a function, app crashes.

plokkingmachine avatar Sep 07 '24 07:09 plokkingmachine

@bjoernmartin I can't reproduce your specific issue, is it consistently reproducing for you everytime? I might need to add a crash check here.

The other issue people are commenting about in this ticket is this one: https://github.com/mattermost/desktop/issues/3129, which is a separate issue.

devinbinnie avatar Sep 09 '24 16:09 devinbinnie

@devinbinnie yes, happens for SVGs every time.

I just created a new private channel, uploaded another SVG and tried to download it. Same error.

I then downloaded an SVG from the internet, just in case it is something we do with SVGs internally. I chose https://www.svgrepo.com/svg/499714/rocket. No change, still getting the error message on download.

bjoernmartin avatar Sep 10 '24 05:09 bjoernmartin

Thanks @bjoernmartin. I still can't reproduce it, so I'm wondering a couple things:

  • Are you in a managed environment? (ie. is there a group policy configured on you system)
  • Is the file being saved to a network drive? I'm wondering if it's having issues grabbing thumbnails from there.

devinbinnie avatar Sep 10 '24 13:09 devinbinnie

* Are you in a managed environment? (ie. is there a group policy configured on you system)

Nope. I installed the computer myself and my company does not even support managing Windows machines :)

* Is the file being saved to a network drive? I'm wondering if it's having issues grabbing thumbnails from there.

Nope. The installation is local and not tampered with in any way. It runs on a Bitlocker-encrypted system, but I cannot imagine this being an issue here.

bjoernmartin avatar Sep 12 '24 13:09 bjoernmartin

@zwolinski you mentioned getting "the same" error. This refers to the original one from me?

 Failed to get thumbnail from local thumbnail cache reference

Or the additional one mentioned by @dragonis41 ?

s.nativeImage.createThumbnailFromPath is not a function

Just trying to figure out if I'm the only one with "my" error.

bjoernmartin avatar Sep 12 '24 13:09 bjoernmartin

I am Facing the same issue while downloading the jpg,svg etc., Mattermost Desktop Version 5.9.0

Operating System x86_64 GNU/Linux

Mattermost Server Version CE 9.11.1

Electron Version 31.6.0-2

Looks like Issues with the electron version

Application: Mattermost 5.9.0 [commit: 5.9.0
]
Platform: Linux 6.11.2-zen1-1-zen x64
TypeError: s.nativeImage.createThumbnailFromPath is not a function
    at C.formatDownloadItem (/usr/lib/mattermost-desktop/app.asar/index.js:2:258337)
    at C.upsertFileToDownloads (/usr/lib/mattermost-desktop/app.asar/index.js:2:255745)
    at C.doneEventController (/usr/lib/mattermost-desktop/app.asar/index.js:2:257101)
    at DownloadItem.<anonymous> (/usr/lib/mattermost-desktop/app.asar/index.js:2:254907)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

Annavar-satish avatar Oct 10 '24 07:10 Annavar-satish

@Annavar-satish that is a different issue and got solved via #3129, as stated by @devinbinnie before. That fix is not released yet though (we are still at 5.9.0, 5.9.1 and 5.10.0 should contain the fix).

bjoernmartin avatar Oct 12 '24 16:10 bjoernmartin

So Linux crashes because of https://github.com/mattermost/desktop/issues/3129 and now Windows crashes because of this one. :disappointed:

licaon-kter avatar Oct 22 '24 08:10 licaon-kter

I looked at an image and then wanted to download it. The download was effective, but the error still occurred. Tested several times. Fedora Linux

Application: Mattermost 5.9.0
Platform: Linux 6.11.4-201.fc40.x86_64 x64
TypeError: s.nativeImage.createThumbnailFromPath is not a function
    at C.formatDownloadItem (/app/main/resources/app.asar/index.js:2:258218)
    at C.upsertFileToDownloads (/app/main/resources/app.asar/index.js:2:255626)
    at C.doneEventController (/app/main/resources/app.asar/index.js:2:256982)
    at DownloadItem.<anonymous> (/app/main/resources/app.asar/index.js:2:254788)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

ilippert avatar Oct 26 '24 16:10 ilippert

#3188 is very similar in behavior, but on a different platform. I do believe they are related.

goutnet avatar Oct 28 '24 15:10 goutnet

After more analysis, it seems we have the same issue on Linux. I close #3188 since it would be a duplicate of this issue, with the same message.

As mentioned above #3188 could also be another instance of #3129, I'll wait for the 5.9.1 to confirm

goutnet avatar Oct 29 '24 02:10 goutnet

https://github.com/mattermost/desktop/issues/3129 is fixed on v5.10.0-rc.2 if anyone wants to try that. It might also fix the issue in the screenshot above.

devinbinnie avatar Oct 29 '24 13:10 devinbinnie

My Desktop Mattermost crash too when I try to download a png or jpeg file but the error is different, I don't know if this is related to the same issue.

I'm on Manjaro with kernel 6.10 Mattermost 5.9.0 Desktop

Application: Mattermost 5.9.0 [commit: 5.9.0]
Platform: Linux 6.10.6-10-MANJARO x64
TypeError: s.nativeImage.createThumbnailFromPath is not a function
    at C.formatDownloadItem (/usr/lib/mattermost-desktop/app.asar/index.js:2:258337)
    at C.upsertFileToDownloads (/usr/lib/mattermost-desktop/app.asar/index.js:2:255745)
    at C.doneEventController (/usr/lib/mattermost-desktop/app.asar/index.js:2:257101)
    at DownloadItem.<anonymous> (/usr/lib/mattermost-desktop/app.asar/index.js:2:254907)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

I have the same error while trying to download an image. Bug is fully reproducible. OS: Debian 12 KDE Plazma: 5.27.5 Graphics environment: Wayland Mattermost version:

Версия Mattermost: 10.1.2 Версия схемы базы данных: 127 Номер сборки: 11462506876 База данных: postgres

ilyasaharov avatar Nov 20 '24 15:11 ilyasaharov

@ilyasaharov 5.10.0 is out since last week, do test it too

licaon-kter avatar Nov 20 '24 15:11 licaon-kter

Tested again with 5.10.1 and found out the following: Downloading a recent SVG worked (we have a UX channel where SVGs pop up once in a while). However, downloading the SVG I initially had issues with did still not work. Log output:

Application: Mattermost 5.10.1
Platform: Windows_NT 10.0.22631 x64
Error: Failed to get thumbnail from local thumbnail cache reference
    at C.formatDownloadItem (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:262941)
    at C.upsertFileToDownloads (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:260223)
    at C.doneEventController (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:261579)
    at DownloadItem.<anonymous> (C:\Users\martin\AppData\Local\Programs\mattermost-desktop\resources\app.asar\index.js:2:259385)
    at Object.onceWrapper (node:events:634:26)
    at DownloadItem.emit (node:events:519:28)

So I did the following:

  • Delete all folders ending with cache that are located within <user>/AppData/Roaming/Mattermost/ to check if it's a problem with the local cache -> ❌ same behavior
  • Uninstall Mattermost, delete <user>/AppData/Local/Mattermost/ and <user>/AppData/Roaming/Mattermost/, and reinstall it -> ❌ same behavior

So it looks to me as if Mattermost cannot generate previews for some SVGs and thus runs into the follow-up issue of not finding anything within the cache. Since it contains no real secrets, I attached the SVG that causes the issue for me: Mattermost-Killer-SVG

Hope this helps to identify the issue.

bjoernmartin avatar Nov 21 '24 07:11 bjoernmartin

Well I tested that SVG and it doesn't seem to be that particular file, so I'm guessing it is some strange issue in the Chromium image cache...we can probably just add a crash catch there and just not load a thumbnail if it fails.

Ticket here: https://mattermost.atlassian.net/browse/MM-61919

devinbinnie avatar Nov 21 '24 14:11 devinbinnie

FWIW this seems to be an error internal to Windows, that seems to be hard crashing: https://github.com/electron/electron/blob/main/shell/common/api/electron_api_native_image_win.cc#L69

So just catching it seems to be the best option.

devinbinnie avatar Nov 25 '24 14:11 devinbinnie

I am still experiencing this issue on version 5.10.1.

sennsim avatar Nov 27 '24 14:11 sennsim

It was not fixed in v5.10.1, will be fixed in v5.11.0. You can try nightly if you wish.

devinbinnie avatar Nov 27 '24 15:11 devinbinnie