mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
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:
parent
37dfbca094
commit
f727934a42
2 changed files with 8 additions and 4 deletions
|
@ -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:
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue