Skip to content

Commit

Permalink
Simplified isDirectory check during readingIntent evaluation for …
Browse files Browse the repository at this point in the history
…`fetchItemList()` in LocalFileSystem
  • Loading branch information
tobihagemann committed Mar 11, 2024
1 parent 7b643cb commit 77146f5
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ public class LocalFileSystemProvider: CloudProvider {

private func evaluateReadingIntentForFetchItemList(_ readingIntent: NSFileAccessIntent) throws {
do {
let attributes = try readingIntent.url.promisedItemResourceValues(forKeys: [.nameKey, .fileSizeKey, .contentModificationDateKey, .fileResourceTypeKey])
let itemType = getItemType(from: attributes.fileResourceType)
guard itemType == .folder else {
let attributes = try readingIntent.url.promisedItemResourceValues(forKeys: [.isDirectoryKey])
guard attributes.isDirectory ?? false else {
throw CloudProviderError.itemTypeMismatch
}
} catch CocoaError.fileReadNoSuchFile {
Expand Down

0 comments on commit 77146f5

Please sign in to comment.