Fix image attachment detection

This commit is contained in:
jack
2025-10-15 00:37:40 +01:00
committed by islam
parent e17163b3da
commit d28b58ecb2
+4 -3
View File
@@ -1573,7 +1573,6 @@ private extension ContentView {
let standardized = url.standardizedFileURL
let path = standardized.path
guard path == basePath || path.hasPrefix(basePath + "/") else { return nil }
guard FileManager.default.fileExists(atPath: path) else { return nil }
return standardized
}
@@ -2065,8 +2064,10 @@ private extension ContentView {
func applicationFilesDirectory() -> URL? {
do {
let base = try FileManager.default.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
return base.appendingPathComponent("files", isDirectory: true)
let base = try FileManager.default.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
let filesDir = base.appendingPathComponent("files", isDirectory: true)
try FileManager.default.createDirectory(at: filesDir, withIntermediateDirectories: true, attributes: nil)
return filesDir
} catch {
SecureLogger.error("Failed to resolve application files directory: \(error)", category: .session)
return nil