Skip to content

Commit

Permalink
Improve OSS config validation (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
baijunyao committed Jun 24, 2020
1 parent 2549ef5 commit bcea1d5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/Http/Requests/Config/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@ public function withValidator($validator)
if ($this->has('204') && !in_array('public', $this->input('204'))) {
$validator->errors()->add('204', __('Local drive must be checked'));
}

if ($this->has('204') && in_array('oss_uploads', $this->input('204')) && !$this->isJson()) {
foreach ([
200 => 'AccessKeyID',
201 => 'AccessKeySecret',
202 => 'BUCKET',
203 => 'ENDPOINT',
] as $id => $description) {
if ($this->input($id, '') === '') {
$validator->errors()->add($id, $description . ': ' . __('The content can not be empty'));
}
}
}
});
}
}

0 comments on commit bcea1d5

Please sign in to comment.