Skip to content

Commit b41d6c0

Browse files
authored
fix: file size limit for guest pages (#359)
1 parent f56cee5 commit b41d6c0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

client/components/open/forms/OpenFormField.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,11 @@ export default {
272272
}
273273
} else if (field.type === 'files' || (field.type === 'url' && field.file_upload)) {
274274
inputProperties.multiple = (field.multiple !== undefined && field.multiple)
275-
inputProperties.mbLimit = Math.min(Math.max(field.max_file_size, 1), this.form?.max_file_size ?? this.currentWorkspace?.max_file_size)
275+
let maxFileSize = (this.form?.workspace && this.form?.workspace.max_file_size) ? this.form?.workspace?.max_file_size : 10
276+
if (field?.max_file_size > 0) {
277+
maxFileSize = Math.min(field.max_file_size, maxFileSize)
278+
}
279+
inputProperties.mbLimit = maxFileSize
276280
inputProperties.accept = (this.form.is_pro && field.allowed_file_types) ? field.allowed_file_types : ''
277281
} else if (field.type === 'rating') {
278282
inputProperties.numberOfStars = parseInt(field.rating_max_value) ?? 5

client/components/open/forms/fields/components/FieldOptions.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ export default {
343343
return !this.typesWithoutPlaceholder.includes(this.field.type)
344344
},
345345
mbLimit() {
346-
return this.form?.max_file_size ?? this.currentWorkspace?.max_file_size
346+
return (this.form?.workspace && this.form?.workspace.max_file_size) ? this.form?.workspace?.max_file_size : 10
347347
},
348348
prefillSelectsOptions() {
349349
if (!['select', 'multi_select'].includes(this.field.type)) return {}

0 commit comments

Comments
 (0)