mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-11 01:10:09 +03:00
Unable to download icon: reqwest::Error DecompressError #591
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Nicnl on GitHub.
Subject of the issue
The icon of a website isn't being downloaded.
Website: https://www.labanquepostale.fr/ (It's a French bank, so quite a large thing)
A favicon seems to exist: https://www.labanquepostale.fr/favicon.ico
Here is the logs I'm getting:
I see a
DecompressError, not sure if it's related to the HTTP stream or if it's some kind of decoding of the dot-ico file.Deployment environment
Docker with docker-compose.
Support string:
Your environment (Generated via diagnostics page)
Config (Generated via diagnostics page)
Show Running Config
Environment settings which are overridden: ADMIN_TOKEN
Steps to reproduce
Try to download the icon of labanquepostale.fr through the icon API endpoint.
Expected behaviour
The icon of labanquepostale.fr (https://www.labanquepostale.fr/favicon.ico) should be successfully forwarded.
Actual behaviour
The console log produces a
DecompressErrorand the default icon is provided.@BlackDex commented on GitHub:
The servers are very different, so yea not comparable.
That might be an option, but as mentioned, not yet checked it out.
It also never had been reported before, so this is a nice one too test it 😄
@Nicnl commented on GitHub:
I'm not proficient with Rust specifically, but at least I did a GET using the reqwest library.
I'm probably not using the same lib version as vaultwarden.
Anyway: no issue with the request on my side.
I dug further.
The provided favicon is named
favicon.ico, but the file actually contains a bitmap.Meanwhile, the server answers with this content-type:
Content-Type: image/x-iconI think that the decoding trusts either the extension or the Content-Type, which conflicts with the actual file content.
@BlackDex commented on GitHub:
It could also be a bug in reqwest btw.
@BlackDex commented on GitHub:
It probably instructs the clients via headers that the stream is compressed, but either isn't, or isn't using the compression it reports it's using.
I haven't looked into it, but I'm afraid it's not something we can fix easily on our side if that is the case.
@Nicnl commented on GitHub:
For some reason, the official bitwarden implementation/server seems to handle it just fine.
https://vault.bitwarden.com/icons/www.labanquepostale.fr/icon.png
I guess that the reqwest library behaves differently than what they use in their c# server.
I may have an idea.
When a DecompressError is produced, why not retry the request while forcing the
Accept-Encoding : identityHTTP header?That would disable compression altogether and effectively bypass the issue.
@BlackDex commented on GitHub:
@Nicnl I did some testing, but the problem is actually at the sites endpoint. For example, we sent
gzip, br, deflatewhich indicates to prefergzipbut it ignores it.Using curl to download the compressed data in
deflateformat, it returns an invalid file. I tested some others sites with the same technique and they all return valid deflate compressed data.If i use
gzipon that site it also works just fine.We can do two things, leave it as-is, since the site is at fault here, and adding a check for this seems a bit to much in my opinion.
We can also remove the
deflatefeature, which also seems to be working. Looking at https://w3techs.com/technologies/details/ce-compression, it doesn't seem to be used that much at all.My go would probably be the removal of the
deflatefeature.@BlackDex commented on GitHub:
We always return
*.pngextensions, but the browser check the image headers/magic instead of trusting the extensions or the server headers returned.The download is probably working just fine, but since we have gzip/brotli enabled, that might cause an issue.