Skip to content

Commit a4a60f1

Browse files
committed
修复文件名含有特殊字符导致排版异常的 bug.(Fixed #471)
1 parent 5071c3a commit a4a60f1

File tree

5 files changed

+216
-209
lines changed

5 files changed

+216
-209
lines changed

app/Http/Requests/AlbumRequest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AlbumRequest extends FormRequest
1212
public function rules()
1313
{
1414
return [
15-
'name' => 'required|max:60',
15+
'name' => 'required|max:60|alpha_dash',
1616
'intro' => 'max:600'
1717
];
1818
}
@@ -22,6 +22,7 @@ public function messages()
2222
return [
2323
'name.required' => '名称不能为空',
2424
'name.max' => '名称字符过长,最大不能超过 60',
25+
'name.alpha_dash' => '名称只能是字母、数字,短破折号(-)和下划线(_)',
2526
'intro.max' => '简介字符过长,最大不能超过 600'
2627
];
2728
}

app/Http/Requests/ImageRenameRequest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function rules()
2323
{
2424
return [
2525
'id' => 'required|numeric',
26-
'name' => 'required|max:50|string',
26+
'name' => 'required|max:50|string|alpha_dash',
2727
];
2828
}
2929

@@ -34,7 +34,8 @@ public function messages()
3434
'id.numeric' => '图片选择异常',
3535
'name.required' => '请输入名称',
3636
'name.max' => '名称长度不能超过 50 个字符',
37-
'name.string' => '名称格式不正确'
37+
'name.string' => '名称格式不正确',
38+
'name.alpha_dash' => '名称只能是字母、数字,短破折号(-)和下划线(_)'
3839
];
3940
}
4041
}

0 commit comments

Comments
 (0)