Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion File Provider Extension/FileProviderEnumerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
var paginateOffset = 0
if pageNumber > 0 {
paginateOffset = getOffset(for: pageNumber)
} else {
// A listing restarting at page 0 must not reuse the cached result or the page counts of an earlier one.
paginateToken = nil
paginatedTotal = 0
paginateItems.removeAll()
}
let optionsPaginate = await FileProviderData.shared.isPaginatedAvailabile(serverUrl: serverUrl, session: session)
let options = NKRequestOptions(paginate: optionsPaginate,
Expand Down Expand Up @@ -230,7 +235,8 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
if let headers = resultsRead.responseData?.response?.allHeaderFields as? [String: String] {
let normalizedHeaders = Dictionary(uniqueKeysWithValues: headers.map { ($0.key.lowercased(), $0.value) })
ncPaginate = Bool(normalizedHeaders["x-nc-paginate"] ?? "false") ?? false
self.paginateToken = normalizedHeaders["x-nc-paginate-token"]
// Pages served from the server's cache may omit the token; it stays valid for the whole listing.
self.paginateToken = normalizedHeaders["x-nc-paginate-token"] ?? self.paginateToken
if let totalString = normalizedHeaders["x-nc-paginate-total"],
let total = Int(totalString) {
self.paginatedTotal = total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ final class NCMediaMetadataBackfillProcessor {
return .completed(account: account.account, processed: processed, inserted: inserted, updated: updated)
}

token = result.token
// Pages served from the server's cache may omit the token; it stays valid for the whole search.
token = result.token ?? token
}

guard let cursorDate = oldestProcessedDate else {
Expand Down