You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
This is the code snipped in question (HttpUriFetcher):
// Write the response to the disk cache.
if (response.code == HTTP_NOT_MODIFIED && cacheResponse != null) {
// Only update the metadata.
val combinedResponse = response.newBuilder()
.headers(combineHeaders(CacheResponse(response).responseHeaders, response.headers))
.build()
fileSystem.write(editor.metadata) {
CacheResponse(combinedResponse).writeTo(this)
}
}
and in particular this line: .headers(combineHeaders(CacheResponse(response).responseHeaders, response.headers))
From what I see are CacheResponse(response).responseHeaders and response.headers referencing the same object.
I assume cacheResponse.responseHeaders and response.headers should be combined instead.
Changing cacheResponse.responseHeaders and response.headers would probably fix my problem too, which depends on loading images from disk, but first checks if the image has been updated by asking the server (must-revalidate / etag).
I found this issue, because in my case cacheResponse holds the info about cache-control = must-revalidate (which is already stored in the metadata), which gets lost when metadata is overwritten, since the response (with code HTTP_NOT_MODIFIED) doesn't contain the cache-control headers anymore.
=> My temporary fix is adding this cache-control headers to the response of the must-revalidate-Request.
Version
io.coil-kt:coil-base:2.0.0-rc02
The text was updated successfully, but these errors were encountered:
Describe the bug
This is the code snipped in question (HttpUriFetcher):
and in particular this line:
.headers(combineHeaders(CacheResponse(response).responseHeaders, response.headers))
From what I see are
CacheResponse(response).responseHeaders
andresponse.headers
referencing the same object.I assume
cacheResponse.responseHeaders
andresponse.headers
should be combined instead.Changing
cacheResponse.responseHeaders
andresponse.headers
would probably fix my problem too, which depends on loading images from disk, but first checks if the image has been updated by asking the server (must-revalidate / etag).I found this issue, because in my case cacheResponse holds the info about cache-control = must-revalidate (which is already stored in the metadata), which gets lost when metadata is overwritten, since the response (with code HTTP_NOT_MODIFIED) doesn't contain the cache-control headers anymore.
=> My temporary fix is adding this cache-control headers to the response of the must-revalidate-Request.
Version
io.coil-kt:coil-base:2.0.0-rc02
The text was updated successfully, but these errors were encountered: