-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to decode source data directly if we fail to write it to disk.
Currently if you disable the disk cache using DiskCacheAdapter or some similarly non-functional implementation, any attempt to load remote data with DiskCacheStrategy.AUTOMATIC or any data at all with DiskCacheStrategy.DATA will fail. In both of these scenarios Glide expects the data to be written to the disk cache first, then decoded from the disk cache. So if the disk cache can't write the data, the load fails. Here we're changing Glide so that even with these strategies we attempt to fall back to decoding the original data, if we can rewind it. I can imagine this behavior being confusing in some cases where someone misconfigures the disk cache. Arguably this change should be limited to DiskCacheStrategy.AUTOMATIC. I've decided to just keep this always because it's probably better to succeed at loading if we can, even if we fail to cache the image and doing so introduces some confusion. For users who want to disable the disk cache entirely, it's also unexpected for the default behavior in Glide to be to fail 100% of remote image loads. PiperOrigin-RevId: 368307717
- Loading branch information
1 parent
0ac564f
commit 755c39f
Showing
2 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters