From f53da8cddb316c5a195abb9660bc0fcc06d9d0b5 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 13 May 2026 09:06:10 +0200 Subject: [PATCH 1/3] code Signed-off-by: Marino Faggiana --- .../NKFilePropertyResolver.swift | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift index 39ea3b32..9579e90d 100644 --- a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift +++ b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift @@ -53,6 +53,8 @@ public final class NKFilePropertyResolver { ) -> NKFileProperty { let fileProperty = NKFileProperty() + let normalizedFileExtension = fileExtension.lowercased() + fileProperty.ext = fileExtension // MARK: - Custom MIME types @@ -65,6 +67,43 @@ public final class NKFilePropertyResolver { fileProperty.ext = "whiteboard" return fileProperty + case "text/markdown", "text/x-markdown": + fileProperty.classFile = .document + fileProperty.iconName = .txt + fileProperty.name = "text" + fileProperty.ext = fileExtension.isEmpty ? "md" : fileExtension + return fileProperty + + default: + break + } + + // MARK: - Custom file extensions + + switch normalizedFileExtension { + + case "md", "markdown": + fileProperty.classFile = .document + fileProperty.iconName = .txt + fileProperty.name = "text" + fileProperty.ext = fileExtension.isEmpty ? "md" : fileExtension + return fileProperty + + case "txt", "text", "log", "csv", "tsv": + fileProperty.classFile = .document + fileProperty.iconName = .txt + fileProperty.name = "text" + return fileProperty + + case "swift", "m", "mm", "h", "c", "cpp", "hpp", + "java", "kt", "js", "ts", "html", "css", + "xml", "json", "yaml", "yml", "php", "py", + "rb", "go", "rs", "sh", "sql": + fileProperty.classFile = .document + fileProperty.iconName = .txt + fileProperty.name = "text" + return fileProperty + default: break } From bcd6fb00e5a32ff7d4345249aeb9586a9a35abc4 Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 13 May 2026 09:09:30 +0200 Subject: [PATCH 2/3] code Signed-off-by: Marino Faggiana --- .../TypeIdentifiers/NKFilePropertyResolver.swift | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift index 9579e90d..f734d5e3 100644 --- a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift +++ b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift @@ -60,13 +60,6 @@ public final class NKFilePropertyResolver { switch mimeType { - case "application/vnd.excalidraw+json": - fileProperty.classFile = .document - fileProperty.iconName = .draw - fileProperty.name = "whiteboard" - fileProperty.ext = "whiteboard" - return fileProperty - case "text/markdown", "text/x-markdown": fileProperty.classFile = .document fileProperty.iconName = .txt @@ -104,6 +97,12 @@ public final class NKFilePropertyResolver { fileProperty.name = "text" return fileProperty + case "whiteboard": + fileProperty.classFile = .document + fileProperty.iconName = .draw + fileProperty.name = "whiteboard" + return fileProperty + default: break } From 884cd7d591f711132b896424015b0d2a44819f3a Mon Sep 17 00:00:00 2001 From: Marino Faggiana Date: Wed, 13 May 2026 09:28:21 +0200 Subject: [PATCH 3/3] code Signed-off-by: Marino Faggiana --- .../TypeIdentifiers/NKFilePropertyResolver.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift index f734d5e3..acb5dd93 100644 --- a/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift +++ b/Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift @@ -67,6 +67,12 @@ public final class NKFilePropertyResolver { fileProperty.ext = fileExtension.isEmpty ? "md" : fileExtension return fileProperty + case "application/vnd.excalidraw+json": + fileProperty.classFile = .document + fileProperty.iconName = .draw + fileProperty.name = "whiteboard" + return fileProperty + default: break }