mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +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.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<div class="alert alert-info" role="alert">
|
||||
{% trans "Free disk space" %}: {{ free_space }}<br />
|
||||
{% trans "Make sure the uploaded file is smaller than that." %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{% blocktrans trimmed %}
|
||||
WARNING: You have {{ max_filesize }} available to restore a backup.<br />
|
||||
Exceeding this limit can leave your {{ box_name }} unusable.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
|
||||
<form class="form" enctype="multipart/form-data" method="post">
|
||||
|
||||
@ -151,8 +151,15 @@ class UploadArchiveView(SuccessMessageMixin, FormView):
|
||||
except (PlinthError, PermissionError):
|
||||
logger.error('Error getting information about root partition.')
|
||||
else:
|
||||
context['free_space'] = storage.format_bytes(
|
||||
disk_info["free_bytes"])
|
||||
# The maximum file size that can be uploaded and restored is at
|
||||
# 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
|
||||
|
||||
def form_valid(self, form):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user