Skip to content

Read owner and permissions from PUT response on new file creation#4105

Open
mpivchev wants to merge 7 commits into
masterfrom
share-put-response
Open

Read owner and permissions from PUT response on new file creation#4105
mpivchev wants to merge 7 commits into
masterfrom
share-put-response

Conversation

@mpivchev
Copy link
Copy Markdown
Collaborator

@mpivchev mpivchev commented May 11, 2026

NCKit: nextcloud/NextcloudKit#221
Implements: nextcloud/server#54088

Additional:

  • Use comparable versions for version checks
  • Remove "future" version as it is not applicable anymore.

Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
mpivchev added 6 commits May 18, 2026 13:01
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
@mpivchev mpivchev marked this pull request as ready for review May 18, 2026 12:24
@@ -0,0 +1,39 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
Copy link
Copy Markdown
Collaborator Author

@mpivchev mpivchev May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate Extension that can include all targets

Comment on lines -29 to -33
if capabilities.serverVersionMajor >= self.global.nextcloudVersionFuture {
elementDate = "nc:metadata-photos-original_date_time"
lessDateString = String(lessDate.timeIntervalSince1970)
greaterDateString = String(greaterDate.timeIntervalSince1970)
} else {
Copy link
Copy Markdown
Collaborator Author

@mpivchev mpivchev May 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ex: 32 >= 999999?
This never happens? I removed it @marinofaggiana

Comment on lines -20 to -22
if capabilities.serverVersionMajor >= self.global.nextcloudVersionFuture {
sortedByKeyPath = "datePhotosOriginal"
} else {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never happens? I removed it @marinofaggiana

Comment on lines -183 to -188
if capabilities.serverVersionMajor >= self.global.nextcloudVersionFuture {
predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [
NSPredicate(format: "datePhotosOriginal >= %@ AND datePhotosOriginal <= %@ AND mediaSearch == true", greaterDate as NSDate, lessDate as NSDate),
mediaPredicate
])
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This never happens? I removed it @marinofaggiana

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates upload handling to persist per-file ownership/permission metadata from Nextcloud 34+ PUT responses, while also standardizing server-version checks using a comparable NextcloudVersion type and removing the obsolete “future” version gating.

Changes:

  • Add applyUploadResponse(...) to apply ownerId / permissions from upload responses when supported (NC 34+).
  • Refactor version checks to use NCBrandOptions.shared.isServerVersion(..., greaterOrEqualTo: .vXX) / NextcloudVersion.
  • Remove deprecated “future version” logic and legacy version constants from NCGlobal.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
iOSClient/Utility/NCLivePhoto.swift Switch version gating to comparable version helper.
iOSClient/Networking/NCService.swift Replace unsupported-version check with NextcloudVersion comparison.
iOSClient/Networking/NCNetworking+UploadResponse.swift New helper to apply owner/permission metadata from PUT responses (NC 34+).
iOSClient/Networking/NCNetworking+Upload.swift Thread owner/permission through upload result handling and call applyUploadResponse.
iOSClient/Networking/NCNetworking+NextcloudKitDelegate.swift Extend upload delegate plumbing to include owner/permissions.
iOSClient/Networking/NCAutoUpload.swift Switch to comparable server version checks for MKCOL support.
iOSClient/Networking/E2EE/NCNetworkingE2EEUpload.swift Thread owner/permissions through E2EE upload results and apply them to metadata.
iOSClient/NCGlobal.swift Remove Nextcloud version constants and “future” unsupported checks.
iOSClient/Menu/NCContextMenuProfile.swift Switch to comparable version helper.
iOSClient/Menu/NCContextMenuPlus.swift Switch to comparable version helper.
iOSClient/Media/NCMediaDataSource.swift Remove dead “future version” branches; always use date.
iOSClient/Media/NCMedia+Netwoking.swift Remove dead “future version” DAV date-field branches.
iOSClient/Main/Create/Upload Assets/NCUploadAssetsModel.swift Switch to comparable version helper.
iOSClient/Main/Collection Common/NCCollectionViewCommon+Search.swift Switch unified search gating to comparable version helper.
iOSClient/Data/NCMetadataTranfersSuccess.swift Persist owner/permissions via applyUploadResponse when reporting success.
iOSClient/Assistant/NCAssistantModel.swift Switch version check to comparable version helper.
Nextcloud.xcodeproj/project.pbxproj Add new NCNetworking+UploadResponse.swift to project/targets.
File Provider Extension/FileProviderData.swift Adopt .v32_0_2 version constant; apply owner/permissions after upload completion.
Brand/NCBrand.swift Introduce NextcloudVersion and update isServerVersion API to accept it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread iOSClient/Networking/NCNetworking+UploadResponse.swift
Comment thread iOSClient/Networking/NCNetworking+Upload.swift
Comment thread iOSClient/Networking/NCService.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants