mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Backups: minor adaption of upload file size warning
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
c988d468f2
commit
9cba16e0d0
@ -32,9 +32,11 @@
|
|||||||
You can choose the apps you wish to import after uploading a backup file.
|
You can choose the apps you wish to import after uploading a backup file.
|
||||||
{% endblocktrans %}
|
{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
<div class="alert alert-info" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
{% trans "Free disk space" %}: {{ free_space }}<br />
|
{% blocktrans trimmed %}
|
||||||
{% trans "Make sure the uploaded file is smaller than that." %}
|
WARNING: You have {{ max_filesize }} available to restore a backup.<br />
|
||||||
|
Exceeding this limit can leave your {{ box_name }} unusable.
|
||||||
|
{% endblocktrans %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="form" enctype="multipart/form-data" method="post">
|
<form class="form" enctype="multipart/form-data" method="post">
|
||||||
|
|||||||
@ -151,8 +151,15 @@ class UploadArchiveView(SuccessMessageMixin, FormView):
|
|||||||
except (PlinthError, PermissionError):
|
except (PlinthError, PermissionError):
|
||||||
logger.error('Error getting information about root partition.')
|
logger.error('Error getting information about root partition.')
|
||||||
else:
|
else:
|
||||||
context['free_space'] = storage.format_bytes(
|
# The maximum file size that can be uploaded and restored is at
|
||||||
disk_info["free_bytes"])
|
# most half of the available disk space:
|
||||||
|
# - Django stores uploaded files that do not fit into memory to
|
||||||
|
# disk (/tmp/). These are only copied by form_valid() after
|
||||||
|
# the upload is finished.
|
||||||
|
# - For restoring it's highly advisable to have at least as much
|
||||||
|
# free disk space as the file size.
|
||||||
|
context['max_filesize'] = storage.format_bytes(
|
||||||
|
disk_info["free_bytes"] / 2)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user