diff --git a/hassio/src/components/hassio-upload-snapshot.ts b/hassio/src/components/hassio-upload-snapshot.ts index 5740e0621e..834281d911 100644 --- a/hassio/src/components/hassio-upload-snapshot.ts +++ b/hassio/src/components/hassio-upload-snapshot.ts @@ -27,6 +27,8 @@ declare global { } } +const MAX_FILE_SIZE = 1 * 1024 * 1024 * 1024; // 1GB + @customElement("hassio-upload-snapshot") export class HassioUploadSnapshot extends LitElement { public hass!: HomeAssistant; @@ -51,6 +53,20 @@ export class HassioUploadSnapshot extends LitElement { private async _uploadFile(ev) { const file = ev.detail.files[0]; + if (file.size > MAX_FILE_SIZE) { + showAlertDialog(this, { + title: "Snapshot file is too big", + text: html`The maximum allowed filesize is 1GB.
+ Have a look here on how to restore it.`, + confirmText: "ok", + }); + return; + } + if (!["application/x-tar"].includes(file.type)) { showAlertDialog(this, { title: "Unsupported file format",