Skip to content

Commit 4d088b4

Browse files
Merge pull request #149 from springload/fix/download-file-size
Remove download file-size limits
2 parents a021d51 + e3c4a81 commit 4d088b4

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

Diff for: cdhweb/pages/blocks/download_block.py

+1-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,15 @@
1-
from django.core.exceptions import ValidationError
21
from wagtail import blocks
32
from wagtail.documents.blocks import DocumentChooserBlock
43

54

6-
class LimitedDocumentChooserBlock(DocumentChooserBlock):
7-
def clean(self, value):
8-
document = super().clean(value)
9-
max_file_size = 5 * 1024 * 1024 # 5 MB
10-
11-
# Check if the file size exceeds the limit
12-
if document.file_size > max_file_size:
13-
raise ValidationError("File size exceeds the limit of 5 MB.")
14-
15-
return document
16-
17-
185
class FileBlock(blocks.StructBlock):
196
title = blocks.CharBlock(
207
help_text="Title for this file as you'd like it to be seen by the public. It will fall back to document title if this field is empty",
218
label="Customised File Title",
229
required=False,
2310
)
2411

25-
file = LimitedDocumentChooserBlock(
12+
file = DocumentChooserBlock(
2613
verbose_name="Document",
2714
required=True,
2815
)

0 commit comments

Comments
 (0)