Skip to content
Merged

MKV #220

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions Sources/NextcloudKit/TypeIdentifiers/NKFilePropertyResolver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ public final class NKFilePropertyResolver {

let fileProperty = NKFileProperty()
let normalizedFileExtension = fileExtension.lowercased()
let normalizedMimeType = mimeType.lowercased()
fileProperty.ext = fileExtension

// MARK: - Custom MIME types

switch mimeType {
switch normalizedMimeType {

case "text/markdown", "text/x-markdown":
fileProperty.classFile = .document
Expand All @@ -73,6 +74,18 @@ public final class NKFilePropertyResolver {
fileProperty.name = "whiteboard"
return fileProperty

case "video/x-matroska", "video/matroska", "video/webm":
fileProperty.classFile = .video
fileProperty.iconName = .video
fileProperty.name = "movie"
return fileProperty

case "audio/x-matroska", "audio/matroska", "audio/webm":
fileProperty.classFile = .audio
fileProperty.iconName = .audio
fileProperty.name = "audio"
return fileProperty

default:
break
}
Expand Down Expand Up @@ -109,13 +122,25 @@ public final class NKFilePropertyResolver {
fileProperty.name = "whiteboard"
return fileProperty

case "mkv", "mk3d", "mks", "webm":
fileProperty.classFile = .video
fileProperty.iconName = .video
fileProperty.name = "movie"
return fileProperty

case "mka":
fileProperty.classFile = .audio
fileProperty.iconName = .audio
fileProperty.name = "audio"
return fileProperty

default:
break
}

// MARK: - Collabora / Office

if capabilities.richDocumentsMimetypes.contains(mimeType) {
if capabilities.richDocumentsMimetypes.contains(mimeType) || capabilities.richDocumentsMimetypes.contains(normalizedMimeType) {
fileProperty.classFile = .document
fileProperty.iconName = .document
fileProperty.name = "document"
Expand Down
Loading