CHANGE collection size too large error to add MB values and info about compressed vs. uncompressed. (#3981)

* CHANGE collection size too large error to add MB values and info about compressed vs. uncompressed

* Round f64 to 2 decimals

* Remove line breaks from ftl/core

* Remove string 'uncompressed' from code

* Add string 'uncompressed' to ftl/core

* Remove if statement change introduced to test changes locally

* Run ./check
This commit is contained in:
GithubAnon0000 2025-05-15 05:08:41 +00:00 committed by GitHub
parent 37dfbca094
commit f727934a42
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -51,9 +51,9 @@ sync-account-required =
sync-sanity-check-failed = Please use the Check Database function, then sync again. If problems persist, please force a one-way sync in the preferences screen.
sync-clock-off = Unable to sync - your clock is not set to the correct time.
sync-upload-too-large =
Your collection file is too large to send to AnkiWeb. You can reduce its
size by removing any unwanted decks (optionally exporting them first), and
then using Check Database to shrink the file size down. ({ $details })
Your collection file is too large to send to AnkiWeb. You can reduce its size by removing any unwanted decks (optionally exporting them first), and then using Check Database to shrink the file size down.
{ $details } (uncompressed)
sync-sign-in = Sign in
sync-ankihub-dialog-heading = AnkiHub Login
sync-ankihub-username-label = Username or Email:

View file

@ -119,9 +119,13 @@ pub enum UploadResponse {
}
pub fn check_upload_limit(size: usize, limit: usize) -> Result<()> {
let size_of_one_mb: f64 = 1024.0 * 1024.0;
let collection_size_in_mb: f64 = size as f64 / size_of_one_mb;
let limit_size_in_mb: f64 = limit as f64 / size_of_one_mb;
if size >= limit {
Err(AnkiError::sync_error(
format!("{size} > {limit}"),
format!("{collection_size_in_mb:.2} MB > {limit_size_in_mb:.2} MB"),
SyncErrorKind::UploadTooLarge,
))
} else {