Fix OTG album local path storage

This commit is contained in:
2026-07-08 10:25:35 +08:00
parent e9f593643f
commit 773fbd1180
8 changed files with 206 additions and 76 deletions

View File

@ -134,17 +134,17 @@ enum TravelAlbumOTGPhotoFormatMatcher {
extension TravelAlbumOTGPhotoRecord {
///
func toPhotoItem() -> TravelAlbumOTGPhotoItem {
func toPhotoItem(storage: TravelAlbumOTGPhotoStore, albumId: Int) -> TravelAlbumOTGPhotoItem {
let previewPath = [thumbnailPath, localPath, remoteUrl].first { path in
guard !path.isEmpty else { return false }
if path.hasPrefix("http") { return true }
return FileManager.default.fileExists(atPath: path)
return storage.fileExists(relativePath: path, albumId: albumId)
} ?? ""
let previewURL: URL?
if previewPath.hasPrefix("http") {
previewURL = URL(string: previewPath)
} else if !previewPath.isEmpty {
previewURL = URL(fileURLWithPath: previewPath)
previewURL = storage.absoluteURL(for: previewPath, albumId: albumId)
} else {
previewURL = nil
}