Print current size not just limit

This commit is contained in:
Andras Schmelczer 2025-03-22 20:32:02 +00:00
commit 62427183fd
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -369,23 +369,26 @@ export class UnrestrictedSyncer {
this.logger.debug(`Syncing ${relativePath} (${syncType})`); this.logger.debug(`Syncing ${relativePath} (${syncType})`);
try { try {
if ( if (await this.operations.exists(relativePath)) {
(await this.operations.exists(relativePath)) && const sizeInMB = Math.round(
(await this.operations.getFileSize(relativePath)) / // this can throw FileNotFoundError (await this.operations.getFileSize(relativePath)) /
1024 / 1024 /
1024 > 1024
this.settings.getSettings().maxFileSizeMB );
) {
if (sizeInMB > this.settings.getSettings().maxFileSizeMB) {
this.history.addHistoryEntry({ this.history.addHistoryEntry({
status: SyncStatus.ERROR, status: SyncStatus.ERROR,
relativePath, relativePath,
message: `File size exceeds the maximum file size limit of ${ message: `File size of ${sizeInMB} MB exceeds the maximum file size limit of ${
this.settings.getSettings().maxFileSizeMB this.settings.getSettings().maxFileSizeMB
}MB`, } MB`,
type: syncType type: syncType
}); });
return; return;
} }
}
return await fn(); return await fn();
} catch (e) { } catch (e) {