Fix File Upload (#952)

* Log correct file name

* Remove duplicated throws comment

* Set maxSize

* Add hints

* Fix unit conversion

* Add translations
This commit is contained in:
MartinOscar 2025-02-14 11:11:52 +01:00 committed by GitHub
parent 09375df8a7
commit b355830db4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 3 deletions

View File

@ -224,6 +224,9 @@ class CreateNode extends CreateRecord
->columnSpan(2),
TextInput::make('upload_size')
->label(trans('admin/node.upload_limit'))
->helperText(trans('admin/node.upload_limit_help.0'))
->hintIcon('tabler-question-mark')
->hintIconTooltip(trans('admin/node.upload_limit_help.1'))
->columnSpan(1)
->numeric()->required()
->default(256)

View File

@ -271,6 +271,8 @@ class EditNode extends EditRecord
'lg' => 1,
])
->label(trans('admin/node.upload_limit'))
->hintIcon('tabler-question-mark')
->hintIconTooltip(trans('admin/node.upload_limit_help.0') . trans('admin/node.upload_limit_help.1'))
->numeric()->required()
->minValue(1)
->maxValue(1024)

View File

@ -474,7 +474,7 @@ class ListFiles extends ListRecords
Activity::event('server:file.uploaded')
->property('directory', $this->path)
->property('file', $file->getFilename())
->property('file', $file->getClientOriginalName())
->log();
}
} elseif ($data['url'] !== null) {
@ -498,10 +498,10 @@ class ListFiles extends ListRecords
->live()
->schema([
FileUpload::make('files')
->label('File(s)')
->storeFiles(false)
->previewable(false)
->preserveFilenames()
->maxSize((int) round($server->node->upload_size * (config('panel.use_binary_prefix') ? 1.048576 * 1024 : 1000)))
->multiple(),
]),
Tab::make('Upload From URL')

View File

@ -14,7 +14,6 @@ class DaemonFileRepository extends DaemonRepository
*
* @param int|null $notLargerThan the maximum content length in bytes
*
* @throws ConnectionException
* @throws FileSizeTooLargeException
* @throws ConnectionException
* @throws FileNotFoundException

View File

@ -52,6 +52,10 @@ return [
'tags' => 'Tags',
'upload_limit' => 'Upload Limit',
'upload_limit_help' => [
'Enter the maximum size of files that can be uploaded through the web-based file manager.',
'Make sure your webserver supports file uploads of this size!',
],
'sftp_port' => 'SFTP Port',
'sftp_alias' => 'SFTP Alias',
'sftp_alias_help' => 'Display alias for the SFTP address. Leave empty to use the Node FQDN.',