change applied and updated tests (#3751)

This commit is contained in:
Mauro
2025-02-07 10:08:35 +01:00
committed by GitHub
parent b9e6a3328f
commit ac34f9f208
30 changed files with 81 additions and 63 deletions
@@ -6,6 +6,7 @@
//
import SwiftUI
import UniformTypeIdentifiers
extension String {
/// Returns the string as an `AttributedString` with the specified character tinted in a different color.
@@ -107,3 +108,13 @@ extension String {
return "#\(aliasLocalPart):\(serverName)"
}
}
extension String {
var validatedFileExtension: String {
let fileExtension = (self as NSString).pathExtension
guard !fileExtension.isEmpty else {
return "bin"
}
return UTType(filenameExtension: fileExtension) != nil ? fileExtension : "bin"
}
}