Fix OTG album local path storage
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user