mirror of
https://github.com/thelounge/thelounge
synced 2025-02-16 13:18:24 +00:00
Use existing friendlysize helper function
This commit is contained in:
parent
024c1d00b9
commit
b404d33338
1 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue