Skip to content

Commit d7bdcb0

Browse files
committed
Fixed column name
Signed-off-by: Arnau Mora <arnyminerz@proton.me>
1 parent 3aaa870 commit d7bdcb0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

app/src/main/kotlin/at/bitfire/davdroid/db/WebDavDocument.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import java.time.Instant
3232
Index("parentId")
3333
]
3434
)
35+
// If any column name is modified, also change it in [DavDocumentsProvider$queryChildDocuments]
3536
data class WebDavDocument(
3637

3738
@PrimaryKey(autoGenerate = true)

app/src/main/kotlin/at/bitfire/davdroid/webdav/DavDocumentsProvider.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,20 @@ class DavDocumentsProvider(
287287
runningQueryChildren.remove(parentId)
288288

289289
// Regardless of whether the worker is done, return the children we already have
290-
val children = if (sortOrder == null) documentDao.getChildren(parentId) else documentDao.getChildrenOrdered(parentId, sortOrder)
290+
val children = if (sortOrder == null) {
291+
documentDao.getChildren(parentId)
292+
} else {
293+
documentDao.getChildrenOrdered(
294+
parentId,
295+
// Convert the cursor's column name into Room's
296+
sortOrder
297+
.replace(Document.COLUMN_DOCUMENT_ID, "id")
298+
.replace(Document.COLUMN_DISPLAY_NAME, "displayName")
299+
.replace(Document.COLUMN_MIME_TYPE, "mimeType")
300+
.replace(Document.COLUMN_SIZE, "size")
301+
.replace(Document.COLUMN_LAST_MODIFIED, "lastModified")
302+
)
303+
}
291304
for (child in children) {
292305
val bundle = child.toBundle(parent)
293306
result.addRow(bundle)

0 commit comments

Comments
 (0)