File Provider Remote Change Discovery Fix#9424
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request fixes a bug where the macOS File Provider VFS was not properly detecting and reflecting server-side changes (renames, deletions, etc.). The fix restructures the remote change detection architecture by moving responsibility from the File Provider extension to the main application.
Changes:
- Moved remote change detection from File Provider extension to main app's existing polling/push notification infrastructure
- Added root ETag tracking in FolderMan to detect changes for File Provider domains
- Integrated File Provider domain signaling with both polling and push notification flows
- Removed RemoteChangeObserver class and its associated test infrastructure from the File Provider extension
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gui/macOS/fileproviderdomainmanager.h | Made signalEnumeratorChanged public to allow calls from FolderMan |
| src/gui/folderman.h | Added _accountRootETags hash to track root ETags per account for File Provider domains |
| src/gui/folderman.cpp | Added ETag polling logic for File Provider domains and integrated signaling with push notifications |
| shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/FileProviderExtension.swift | Removed RemoteChangeObserver instantiation and setup |
| shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift | Added checkMaterializedItemsOnServer method to detect remote changes during working set enumeration |
| shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift | Deleted - functionality moved to main app and Enumerator |
| shell_integration/MacOSX/NextcloudFileProviderKit/Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift | Deleted - tests for removed RemoteChangeObserver class |
| shell_integration/MacOSX/NextcloudFileProviderKit/Tests/NextcloudFileProviderKitTests/RemoteChangeObserverEtagOptimizationTests.swift | Deleted - tests for removed RemoteChangeObserver class |
| shell_integration/MacOSX/NextcloudFileProviderKit/Tests/Interface/MockNotifyPushServer.swift | Deleted - test infrastructure no longer needed |
Comments suppressed due to low confidence (1)
shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift:1
- The
authenticationChallengehandler forNSURLAuthenticationMethodServerTrustunconditionally created aURLCredentialfromserverTrustand completed with.useCredentialwithout validating the certificate chain, effectively disabling TLS server certificate verification for this connection and enabling man-in-the-middle attacks. An active network attacker presenting an arbitrary or self-signed certificate could have it accepted and intercept or modify all traffic for the affected account. RemovingRemoteChangeObserver(and thus this delegate) resolves the issue for this extension as long as remainingNextcloudKitDelegateimplementations rely on the default system trust evaluation rather than similarly bypassing server trust checks.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...acOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift
Outdated
Show resolved
Hide resolved
|
This somehow does not work for the push notification method. The main retrieves the current ETag of the root on the server but it apparently is unchanged despite a file being added to the root on the server through web user interface. |
|
Please i2h3 Save us 🤣 |
nilsding
left a comment
There was a problem hiding this comment.
Overall nice, thanks :)
In a future change this will be really useful to send the specific file IDs to the File Provider extension to even further limit the amount of requests required, but IMO that is out of scope for this PR here.
...acOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/Enumerator.swift
Outdated
Show resolved
Hide resolved
...viderKit/Tests/NextcloudFileProviderKitTests/RemoteChangeObserverEtagOptimizationTests.swift
Show resolved
Hide resolved
|
Hi,
From what I understand it's totally that. Thanks a lot everyone. |
e69b12e to
f839afb
Compare
- Changed: The file provider extension no longer polls or listens for server-side changes by itself. - Changed: The main app, an already existing dependency, is the only process checking for server-side changes. - Changed: The Enumerator in the file provider extension now also checks the locally materialized items for changed ETags on the server to discover remote changes. - Removed: RemoteChangeObserver, MockNotifyPushServer and related tests. Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
…edServerDirectoryShouldNotBeEnumerated Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
f839afb to
5cc1630
Compare
|
@Floweb05 I tested the exact cases you described with the changes in this pull request it works as expected. |
|
Artifact containing the AppImage: nextcloud-appimage-pr-9424.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
Thank you a lot for this kind update. |
|
|
||
| connect(_account->account()->pushNotifications(), &PushNotifications::notificationsChanged, this, &User::slotReceivedPushNotification, Qt::UniqueConnection); | ||
| connect(_account->account()->pushNotifications(), &PushNotifications::activitiesChanged, this, &User::slotReceivedPushActivity, Qt::UniqueConnection); | ||
| connect(_account->account()->pushNotifications(), &PushNotifications::fileIdsChanged, this, &User::slotReceivedPushFileChanges, Qt::UniqueConnection); |
There was a problem hiding this comment.
For compatibility with notify_push < 0.4.0 (April 2022, < Nextcloud 24) the signal without the file-ids should be connected as well.
There was a problem hiding this comment.
Now the auto-merge already happened. I need to split of a new pull request.
… in NextcloudKit. Signed-off-by: Iva Horn <iva.horn@nextcloud.com> # Conflicts: # shell_integration/MacOSX/NextcloudFileProviderKit/Sources/NextcloudFileProviderKit/Enumeration/RemoteChangeObserver.swift
Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
|




Closes #8510.