mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-08 18:28:53 +01:00
Fix EXIF error when converting from JSON
This commit is contained in:
parent
400abd33e4
commit
12421aa1d8
2 changed files with 17 additions and 8 deletions
|
@ -106,12 +106,21 @@ class Album {
|
||||||
File albumFile,
|
File albumFile,
|
||||||
}) {
|
}) {
|
||||||
// there's only one version right now
|
// there's only one version right now
|
||||||
return Album(
|
if (version < 2) {
|
||||||
lastUpdated: lastUpdated,
|
return Album(
|
||||||
name: name,
|
lastUpdated: lastUpdated,
|
||||||
items: items,
|
name: name,
|
||||||
albumFile: albumFile,
|
items: [],
|
||||||
);
|
albumFile: albumFile,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Album(
|
||||||
|
lastUpdated: lastUpdated,
|
||||||
|
name: name,
|
||||||
|
items: items,
|
||||||
|
albumFile: albumFile,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
factory Album.fromJson(Map<String, dynamic> json) {
|
factory Album.fromJson(Map<String, dynamic> json) {
|
||||||
|
@ -191,7 +200,7 @@ class Album {
|
||||||
final File albumFile;
|
final File albumFile;
|
||||||
|
|
||||||
/// versioning of this class, use to upgrade old persisted album
|
/// versioning of this class, use to upgrade old persisted album
|
||||||
static const version = 1;
|
static const version = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
class AlbumRepo {
|
class AlbumRepo {
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Exif {
|
||||||
if (e is Map) {
|
if (e is Map) {
|
||||||
return Rational.fromJson(e.cast<String, dynamic>());
|
return Rational.fromJson(e.cast<String, dynamic>());
|
||||||
} else {
|
} else {
|
||||||
return value;
|
return e;
|
||||||
}
|
}
|
||||||
}).toList();
|
}).toList();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue