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
Copy file name to clipboardExpand all lines: shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift
+43Lines changed: 43 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -212,6 +212,36 @@ public final class FilesDatabaseManager: Sendable {
212
212
.toUnmanagedResults()
213
213
}
214
214
215
+
///
216
+
/// Resolve the parent's "Always keep downloaded" flag for a metadata
217
+
/// that is about to be persisted as a fresh row.
218
+
///
219
+
/// Mirrors the inheritance applied to locally-created items in
220
+
/// `Item+Create.swift` so a sibling appearing via remote enumeration
221
+
/// acquires the same `contentPolicy` and Finder overlay without the user
222
+
/// having to re-toggle the parent (#10054).
223
+
///
224
+
/// Checking only the immediate parent is sufficient: the recursive
225
+
/// enable in `Item.set(keepDownloaded:domain:)` sets the flag on every
226
+
/// then-known descendant of the pinned ancestor, so every intermediate
227
+
/// directory between the pin root and this new item is itself pinned.
228
+
///
229
+
/// Falls back to the root container when no parent row exists at the
230
+
/// item's `serverUrl` — items directly under the user's home are stored
231
+
/// against a synthesised root keyed by ocId, not by serverUrl/fileName.
@@ -272,6 +302,9 @@ public final class FilesDatabaseManager: Sendable {
272
302
}
273
303
274
304
}else{ // This is a new metadata
305
+
// Inherit the parent's "Always keep downloaded" flag so a file surfacing here via remote enumeration acquires the same pin as its already-pinned siblings (#10054).
logger.debug("Created new item metadata during update.",[.item: updatedMetadata.ocId])
@@ -374,6 +407,8 @@ public final class FilesDatabaseManager: Sendable {
374
407
}
375
408
}else{
376
409
logger.info("Depth 1 read target is new: \(readTargetMetadata.ocId)")
410
+
// Inherit from the parent so a directory appearing here via remote enumeration (e.g. created on the server while the user already pinned its parent) picks up the same pin as siblings (#10054).
Copy file name to clipboardExpand all lines: shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/Enumerator+SyncEngine.swift
Copy file name to clipboardExpand all lines: shell_integration/MacOSX/NextcloudFileProviderKit/Tests/NextcloudFileProviderKitTests/FilesDatabaseManagerTests.swift
+89-5Lines changed: 89 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -978,13 +978,14 @@ final class FilesDatabaseManagerTests: NextcloudFileProviderKitTestCase {
978
978
XCTAssertTrue(updatedMetadata.downloaded,"downloaded should be retained when keepExistingDownloadState is true")
0 commit comments