Use existing friendlysize helper function

This commit is contained in:
Brett Gilio 2022-12-24 22:10:23 +00:00
parent 024c1d00b9
commit b404d33338

View file

@ -2,6 +2,7 @@ import {update as updateCursor} from "undate";
import socket from "./socket";
import {store} from "./store";
import friendlysize from "../js/helpers/friendlysize";
class Uploader {
xhr: XMLHttpRequest | null = null;
@ -123,9 +124,9 @@ class Uploader {
}
if (maxFileSize > 0 && file.size > maxFileSize) {
const maxFileSizeInMB = (maxFileSize / 1024 / 1024).toFixed(0);
const maxFileSizeHR = friendlysize(maxFileSize);
this.handleResponse({
error: `File "${file.name}" is larger than the maximum allowed size of ${maxFileSizeInMB} MB`,
error: `File "${file.name}" is larger than the maximum allowed size of ${maxFileSizeHR}`,
});
continue;