Skip to content

Commit d035984

Browse files
committed
Fix RequestBody compilation error in WebDAV PROPFIND request
- Fix RequestBody.create() parameter order for OkHttp API compatibility - Pass RequestBody directly to method() instead of using .body() on null-body requests - Resolves compilation error: cannot find symbol .body() - WebDAV PROPFIND now properly sends XML body for file existence checks
1 parent 9c8ee24 commit d035984

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • src/java/JavaFileStorage/app/src/main/java/keepass2android/javafilestorage

src/java/JavaFileStorage/app/src/main/java/keepass2android/javafilestorage/WebDavStorage.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,15 @@ private boolean fileExists(ConnectionInfo ci) throws Exception {
313313
try {
314314
Request request = new Request.Builder()
315315
.url(new URL(ci.URL))
316-
.method("PROPFIND", null)
317-
.header("Depth", "0")
318-
.header("Content-Type", "application/xml")
319-
.body(RequestBody.create("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
316+
.method("PROPFIND", RequestBody.create(MediaType.parse("application/xml"),
317+
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" +
320318
"<D:propfind xmlns:D=\"DAV:\">\n" +
321319
" <D:prop>\n" +
322320
" <D:resourcetype/>\n" +
323321
" </D:prop>\n" +
324-
"</D:propfind>", MediaType.parse("application/xml")))
322+
"</D:propfind>"))
323+
.header("Depth", "0")
324+
.header("Content-Type", "application/xml")
325325
.build();
326326

327327
Response response = getClient(ci).newCall(request).execute();

0 commit comments

Comments
 (0)