Show More
@@ -17,7 +17,7 b' PowDifficulty = 0' | |||||
17 | PostingDelay = 30 |
|
17 | PostingDelay = 30 | |
18 | Autoban = false |
|
18 | Autoban = false | |
19 | DefaultTag = test |
|
19 | DefaultTag = test | |
20 |
MaxFileCount = |
|
20 | MaxFileCount = 5 | |
21 | AdditionalSpoilerSpaces = false |
|
21 | AdditionalSpoilerSpaces = false | |
22 |
|
22 | |||
23 | [Messages] |
|
23 | [Messages] |
@@ -320,14 +320,19 b' class PostForm(NeboardForm):' | |||||
320 | raise forms.ValidationError( |
|
320 | raise forms.ValidationError( | |
321 | ungettext_lazy(ERROR_MANY_FILES, ERROR_MANY_FILES, |
|
321 | ungettext_lazy(ERROR_MANY_FILES, ERROR_MANY_FILES, | |
322 | max_file_count) % {'files': max_file_count}) |
|
322 | max_file_count) % {'files': max_file_count}) | |
|
323 | ||||
|
324 | size = 0 | |||
323 | for file_input in inputs: |
|
325 | for file_input in inputs: | |
324 | if isinstance(file_input, UploadedFile): |
|
326 | if isinstance(file_input, UploadedFile): | |
325 |
file |
|
327 | file = self._clean_file_file(file_input) | |
|
328 | size += file.size | |||
|
329 | files.append(file) | |||
326 | else: |
|
330 | else: | |
327 | files.append(self._clean_file_url(file_input)) |
|
331 | files.append(self._clean_file_url(file_input)) | |
328 |
|
332 | |||
329 | for file in files: |
|
333 | for file in files: | |
330 | self._validate_image_dimensions(file) |
|
334 | self._validate_image_dimensions(file) | |
|
335 | validate_file_size(size) | |||
331 |
|
336 | |||
332 | return files |
|
337 | return files | |
333 |
|
338 | |||
@@ -342,7 +347,6 b' class PostForm(NeboardForm):' | |||||
342 | raise forms.ValidationError('Possible decompression bomb or large image.') |
|
347 | raise forms.ValidationError('Possible decompression bomb or large image.') | |
343 |
|
348 | |||
344 | def _clean_file_file(self, file): |
|
349 | def _clean_file_file(self, file): | |
345 | validate_file_size(file.size) |
|
|||
346 | self._update_file_extension(file) |
|
350 | self._update_file_extension(file) | |
347 |
|
351 | |||
348 | return file |
|
352 | return file | |
@@ -367,8 +371,6 b' class PostForm(NeboardForm):' | |||||
367 | file = self._get_file_from_url(url) |
|
371 | file = self._get_file_from_url(url) | |
368 | if not file: |
|
372 | if not file: | |
369 | raise forms.ValidationError(_('Invalid URL')) |
|
373 | raise forms.ValidationError(_('Invalid URL')) | |
370 | else: |
|
|||
371 | validate_file_size(file.size) |
|
|||
372 | self._update_file_extension(file) |
|
374 | self._update_file_extension(file) | |
373 | except forms.ValidationError as e: |
|
375 | except forms.ValidationError as e: | |
374 | # Assume we will get the plain URL instead of a file and save it |
|
376 | # Assume we will get the plain URL instead of a file and save it |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -480,8 +480,8 b' msgstr "\xd0\x9e\xd0\xba"' | |||||
480 |
|
480 | |||
481 | #: utils.py:120 |
|
481 | #: utils.py:120 | |
482 | #, python-format |
|
482 | #, python-format | |
483 |
msgid " |
|
483 | msgid "Total file size must be less than %s but is %s." | |
484 |
msgstr " |
|
484 | msgstr "Общий размер файлов должен быть менее %s, но является %s." | |
485 |
|
485 | |||
486 | msgid "Please wait %(delay)d second before sending message" |
|
486 | msgid "Please wait %(delay)d second before sending message" | |
487 | msgid_plural "Please wait %(delay)d seconds before sending message" |
|
487 | msgid_plural "Please wait %(delay)d seconds before sending message" | |
@@ -493,8 +493,8 b' msgid "New threads"' | |||||
493 | msgstr "Новые темы" |
|
493 | msgstr "Новые темы" | |
494 |
|
494 | |||
495 | #, python-format |
|
495 | #, python-format | |
496 | msgid "Max file size is %(size)s." |
|
496 | msgid "Max total file size is %(size)s." | |
497 |
msgstr "Максимальный размер файл |
|
497 | msgstr "Максимальный общий размер файлов %(size)s." | |
498 |
|
498 | |||
499 | msgid "Size of media:" |
|
499 | msgid "Size of media:" | |
500 | msgstr "Размер медиа:" |
|
500 | msgstr "Размер медиа:" |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -480,8 +480,8 b' msgstr "\xd0\xa4\xd0\xb0\xd0\xb9\xd0\xbd\xd0\xbe"' | |||||
480 |
|
480 | |||
481 | #: utils.py:120 |
|
481 | #: utils.py:120 | |
482 | #, python-format |
|
482 | #, python-format | |
483 |
msgid " |
|
483 | msgid "Total file size must be less than %s but is %s." | |
484 |
msgstr " |
|
484 | msgstr "Загальний розмір файлів мусить бути менше %s, але є %s." | |
485 |
|
485 | |||
486 | msgid "Please wait %(delay)d second before sending message" |
|
486 | msgid "Please wait %(delay)d second before sending message" | |
487 | msgid_plural "Please wait %(delay)d seconds before sending message" |
|
487 | msgid_plural "Please wait %(delay)d seconds before sending message" | |
@@ -493,8 +493,8 b' msgid "New threads"' | |||||
493 | msgstr "Нові нитки" |
|
493 | msgstr "Нові нитки" | |
494 |
|
494 | |||
495 | #, python-format |
|
495 | #, python-format | |
496 | msgid "Max file size is %(size)s." |
|
496 | msgid "Max total file size is %(size)s." | |
497 |
msgstr "Максимальний розмір файл |
|
497 | msgstr "Максимальний загальний розмір файлів %(size)s." | |
498 |
|
498 | |||
499 | msgid "Size of media:" |
|
499 | msgid "Size of media:" | |
500 | msgstr "Розмір посередника:" |
|
500 | msgstr "Розмір посередника:" |
@@ -172,7 +172,7 b'' | |||||
172 | <div> |
|
172 | <div> | |
173 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} |
|
173 | {% trans 'Tags must be delimited by spaces. Text or image is required.' %} | |
174 | {% with size=max_file_size|filesizeformat %} |
|
174 | {% with size=max_file_size|filesizeformat %} | |
175 | {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %} |
|
175 | {% blocktrans %}Max total file size is {{ size }}.{% endblocktrans %} | |
176 | {% endwith %} |
|
176 | {% endwith %} | |
177 | {% blocktrans %}Max file number is {{ max_files }}.{% endblocktrans %} |
|
177 | {% blocktrans %}Max file number is {{ max_files }}.{% endblocktrans %} | |
178 | </div> |
|
178 | </div> |
@@ -60,7 +60,7 b'' | |||||
60 | <div id="preview-text"></div> |
|
60 | <div id="preview-text"></div> | |
61 | <div> |
|
61 | <div> | |
62 | {% with size=max_file_size|filesizeformat %} |
|
62 | {% with size=max_file_size|filesizeformat %} | |
63 | {% blocktrans %}Max file size is {{ size }}.{% endblocktrans %} |
|
63 | {% blocktrans %}Max total file size is {{ size }}.{% endblocktrans %} | |
64 | {% endwith %} |
|
64 | {% endwith %} | |
65 | {% blocktrans %}Max file number is {{ max_files }}.{% endblocktrans %} |
|
65 | {% blocktrans %}Max file number is {{ max_files }}.{% endblocktrans %} | |
66 | </div> |
|
66 | </div> |
@@ -102,7 +102,7 b' def validate_file_size(size: int):' | |||||
102 | max_size = boards.settings.get_int('Forms', 'MaxFileSize') |
|
102 | max_size = boards.settings.get_int('Forms', 'MaxFileSize') | |
103 | if 0 < max_size < size: |
|
103 | if 0 < max_size < size: | |
104 | raise forms.ValidationError( |
|
104 | raise forms.ValidationError( | |
105 |
_(' |
|
105 | _('Total file size must be less than %s but is %s.') | |
106 | % (filesizeformat(max_size), filesizeformat(size))) |
|
106 | % (filesizeformat(max_size), filesizeformat(size))) | |
107 |
|
107 | |||
108 |
|
108 |
General Comments 0
You need to be logged in to leave comments.
Login now