Minor bug fixes (#1053)
This commit is contained in:
commit
1917b257cf
1
lib/generated/intl/messages_nl.dart
generated
1
lib/generated/intl/messages_nl.dart
generated
|
@ -878,6 +878,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"publicLinkEnabled":
|
||||
MessageLookupByLibrary.simpleMessage("Publieke link ingeschakeld"),
|
||||
"radius": MessageLookupByLibrary.simpleMessage("Straal"),
|
||||
"raiseTicket": MessageLookupByLibrary.simpleMessage("Meld probleem"),
|
||||
"rateTheApp": MessageLookupByLibrary.simpleMessage("Beoordeel de app"),
|
||||
"rateUs": MessageLookupByLibrary.simpleMessage("Beoordeel ons"),
|
||||
"rateUsOnStore": m18,
|
||||
|
|
|
@ -12,4 +12,18 @@ class Location with _$Location {
|
|||
|
||||
factory Location.fromJson(Map<String, Object?> json) =>
|
||||
_$LocationFromJson(json);
|
||||
|
||||
static isValidLocation(Location? location) {
|
||||
if (location == null) return false;
|
||||
if (location.latitude == null || location.longitude == null) return false;
|
||||
final latValue = location.latitude!;
|
||||
final longValue = location.longitude!;
|
||||
if (latValue.isNaN || latValue.isInfinite || latValue == 0.0) {
|
||||
return false;
|
||||
}
|
||||
if (longValue.isNaN || longValue.isInfinite || longValue == 0.0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,9 +257,7 @@ class LocalFileUpdateService {
|
|||
|
||||
for (ente.File file in enteFiles) {
|
||||
final Location? location = await tryLocationFromExif(file);
|
||||
if (location != null &&
|
||||
(location.latitude ?? 0) != 0.0 &&
|
||||
(location.longitude ?? 0) != 0.0) {
|
||||
if (location != null && Location.isValidLocation(location)) {
|
||||
remoteFilesToUpdate.add(file);
|
||||
fileIDToUpdateMetadata[file.uploadedFileID!] = {
|
||||
pubMagicKeyLat: location.latitude!,
|
||||
|
|
|
@ -305,8 +305,11 @@ class CryptoUtil {
|
|||
args["sourceFilePath"] = sourceFilePath;
|
||||
args["destinationFilePath"] = destinationFilePath;
|
||||
args["key"] = key;
|
||||
return _computer.compute(chachaEncryptFile,
|
||||
param: args, taskName: "encryptFile");
|
||||
return _computer.compute(
|
||||
chachaEncryptFile,
|
||||
param: args,
|
||||
taskName: "encryptFile",
|
||||
);
|
||||
}
|
||||
|
||||
// Decrypts the file at sourceFilePath, with the given key and header using
|
||||
|
|
|
@ -388,14 +388,15 @@ class FileUploader {
|
|||
await io.File(encryptedFilePath).delete();
|
||||
}
|
||||
final encryptedFile = io.File(encryptedFilePath);
|
||||
final fileAttributes = await CryptoUtil.encryptFile(
|
||||
final EncryptionResult fileAttributes = await CryptoUtil.encryptFile(
|
||||
mediaUploadData!.sourceFile!.path,
|
||||
encryptedFilePath,
|
||||
key: key,
|
||||
);
|
||||
final thumbnailData = mediaUploadData.thumbnail;
|
||||
|
||||
final encryptedThumbnailData = await CryptoUtil.encryptChaCha(
|
||||
final EncryptionResult encryptedThumbnailData =
|
||||
await CryptoUtil.encryptChaCha(
|
||||
thumbnailData!,
|
||||
fileAttributes.key!,
|
||||
);
|
||||
|
@ -480,6 +481,7 @@ class FileUploader {
|
|||
await encryptedThumbnailFile.length(),
|
||||
encryptedMetadata,
|
||||
metadataDecryptionHeader,
|
||||
pubMetadata: pubMetadataRequest,
|
||||
);
|
||||
if (mediaUploadData.isDeleted) {
|
||||
_logger.info("File found to be deleted");
|
||||
|
|
Loading…
Reference in a new issue