Fix image attachment detection

This commit is contained in:
jack
2025-10-15 17:37:19 +01:00
committed by islam
parent 515fae9e25
commit 5cbe9d4aa7
+4 -3
View File
@@ -1630,7 +1630,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
} }
@@ -2122,8 +2121,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