Skip to content

Conversation

@i2h3
Copy link
Collaborator

@i2h3 i2h3 commented Oct 14, 2025

  • Our corporate instance was a real world use case in which the retrieved metadata of a directory and its content is no longer fulfilling the previous assumption that the first item is related to the queried directory itself. Instead, it can be anywhere in the array. Hence the implementation had to be changed to detect it by other means while taking the special __NC_ROOT__ case into consideration.
  • While reading, I also applied code style changes based on conventional Swift code style.
  • Further, I hope to improve clarity by renaming some symbols like DirectoryReadConversionActor to DirectoryMetadataContainer which hints its purpose a lot better in my opinion.
  • Also replaced some occurrences of empty strings or __NC_ROOT__ literals with the symbol reference to NextcloudKit.

@i2h3 i2h3 requested a review from Copilot October 14, 2025 12:43
@i2h3 i2h3 self-assigned this Oct 14, 2025
@i2h3 i2h3 added the bug Something isn't working label Oct 14, 2025
@i2h3 i2h3 requested review from camilasan and nilsding October 14, 2025 12:43
Copy link
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

Aligns directory enumeration with WebDAV semantics and NextcloudKit conventions, and refactors metadata conversion to reliably identify the enumerated directory.

  • Replace toDirectoryReadMetadatas with toSendableDirectoryMetadata and introduce isDirectoryToRead to correctly identify the target directory among NKFile entries.
  • Normalize root handling to use NextcloudKit.shared.nkCommonInstance.rootFileName and switch tests to davFilesUrl.
  • Update mock interfaces and tests to reflect the new behavior and expectations.

Reviewed Changes

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

Show a summary per file
File Description
Sources/NextcloudFileProviderKit/Extensions/NKFile+Extensions.swift Adds isDirectoryToRead and toSendableDirectoryMetadata; adjusts root fix-up in toItemMetadata; introduces an actor container for concurrent conversion.
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+SyncEngine.swift Switches to new conversion API and improves logging; ensures directory metadata is inserted for DB updates.
Sources/NextcloudFileProviderKit/Item/Item+Create.swift Uses toSendableDirectoryMetadata during item creation; updates logging and variables.
Tests/NextcloudFileProviderKitTests/NKFileExtensionTests.swift Updates and adds tests for root handling, directory identification, and new conversion API.
Tests/Interface/MockRemoteInterfaceTests.swift Aligns expectations with NextcloudKit root naming and WebDAV path.
Tests/Interface/MockRemoteItem.swift Adjusts root name and NKFile mapping; potential regression in serverUrl mapping for non-root items.
Tests/InterfaceTests/MockRemoteInterfaceTests.swift Imports NextcloudKit and updates assertions for root file naming.
Tests/NextcloudFileProviderKitTests/RemoteChangeObserverTests.swift Uses davFilesUrl in test setup and formats a closure for readability.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Our corporate instance was a real world use case in which the retrieved metadata of a directory and its content is no longer fulfilling the previous assumption that the first item is related to the queried directory itself. Instead, it can be anywhere in the array. Hence the implementation had to be changed to detect it by other means while taking the special `__NC_ROOT__` case into consideration.
- While reading, I also applied code style changes based on conventional Swift code style.
- Further, I hope to improve clarity by renaming some symbols like `DirectoryReadConversionActor` to `DirectoryMetadataContainer` which hints its purpose a lot better in my opinion.
- Also replaced some occurrences of empty strings or `__NC_ROOT__` literals with the symbol reference to NextcloudKit.

Signed-off-by: Iva Horn <142165879+i2h3@users.noreply.github.com>
@i2h3 i2h3 force-pushed the fix/root-enumeration branch from 41b603d to a6d75d3 Compare October 14, 2025 12:56
@i2h3 i2h3 merged commit 9d3a90e into main Oct 14, 2025
2 checks passed
@i2h3 i2h3 deleted the fix/root-enumeration branch October 14, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants