Fix image attachment detection

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