mirror of
https://github.com/bitfireAT/davx5-ose
synced 2024-10-07 03:42:59 +00:00
169 webdav handle weak etags correctly (bitfireAT/davx5#185)
* Added `GetETag.NAME` fetching when `PROPFIND`ing Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> * `GetETag.eTag` is only taken if tag is not weak Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> * Using `GetETag` instead of `QuotedStringUtils` and ignoring weak eTags Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> * Updated `dav4jvm` Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> * Fixed checks Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> * Use new dav4jvm where weak can't be null Signed-off-by: Arnau Mora <arnyminer.z@gmail.com> Co-authored-by: Ricki Hirner <hirner@bitfire.at>
This commit is contained in:
parent
5434291c6c
commit
bee7cf20ac
|
@ -68,11 +68,12 @@ class DavDocumentsProvider: DocumentsProvider() {
|
|||
ResourceType.NAME,
|
||||
CurrentUserPrivilegeSet.NAME,
|
||||
DisplayName.NAME,
|
||||
GetETag.NAME,
|
||||
GetContentType.NAME,
|
||||
GetContentLength.NAME,
|
||||
GetLastModified.NAME,
|
||||
QuotaAvailableBytes.NAME,
|
||||
QuotaUsedBytes.NAME
|
||||
QuotaUsedBytes.NAME,
|
||||
)
|
||||
|
||||
const val MAX_NAME_ATTEMPTS = 5
|
||||
|
@ -262,7 +263,10 @@ class DavDocumentsProvider: DocumentsProvider() {
|
|||
|
||||
resource.displayName = response[DisplayName::class.java]?.displayName
|
||||
resource.mimeType = response[GetContentType::class.java]?.type
|
||||
resource.eTag = response[GetETag::class.java]?.eTag
|
||||
response[GetETag::class.java]?.let { getETag ->
|
||||
if (!getETag.weak)
|
||||
resource.eTag = resource.eTag
|
||||
}
|
||||
resource.lastModified = response[GetLastModified::class.java]?.lastModified
|
||||
resource.size = response[GetContentLength::class.java]?.contentLength
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package at.bitfire.davdroid.webdav
|
|||
|
||||
import at.bitfire.dav4jvm.DavResource
|
||||
import at.bitfire.dav4jvm.HttpUtils
|
||||
import at.bitfire.dav4jvm.QuotedStringUtils
|
||||
import at.bitfire.dav4jvm.property.GetETag
|
||||
import at.bitfire.davdroid.HttpClient
|
||||
import okhttp3.HttpUrl
|
||||
import java.util.*
|
||||
|
@ -25,7 +25,9 @@ class HeadInfoDownloader(
|
|||
|
||||
DavResource(client.okHttpClient, url).head { response ->
|
||||
response.header("ETag", null)?.let {
|
||||
eTag = QuotedStringUtils.decodeQuotedString(it.removeSuffix("W/"))
|
||||
val getETag = GetETag(it)
|
||||
if (!getETag.weak)
|
||||
eTag = getETag.eTag
|
||||
}
|
||||
response.header("Last-Modified", null)?.let {
|
||||
lastModified = HttpUtils.parseDate(it)
|
||||
|
|
|
@ -10,7 +10,7 @@ buildscript {
|
|||
ext.versions = [
|
||||
aboutLibraries: '8.9.4',
|
||||
appIntro: '6.2.0',
|
||||
dav4jvm: '2.2',
|
||||
dav4jvm: 'aac98bd76cf3034194c9ba6d2bf58212083a72a0',
|
||||
hilt: '2.44.2',
|
||||
kotlin: '1.7.21',
|
||||
okhttp: '4.10.0',
|
||||
|
|
Loading…
Reference in a new issue