mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
perf: 文件名长度限制最长为100字
This commit is contained in:
parent
8597705a77
commit
0f41172468
@ -201,8 +201,8 @@ class FileController extends AbstractController
|
|||||||
$pid = intval(Request::input('pid'));
|
$pid = intval(Request::input('pid'));
|
||||||
if (mb_strlen($name) < 2) {
|
if (mb_strlen($name) < 2) {
|
||||||
return Base::retError('文件名称不可以少于2个字');
|
return Base::retError('文件名称不可以少于2个字');
|
||||||
} elseif (mb_strlen($name) > 32) {
|
} elseif (mb_strlen($name) > 100) {
|
||||||
return Base::retError('文件名称最多只能设置32个字');
|
return Base::retError('文件名称最多只能设置100个字');
|
||||||
}
|
}
|
||||||
$tmpName = preg_replace("/[\\\\\/:*?\"<>|]/", '', $name);
|
$tmpName = preg_replace("/[\\\\\/:*?\"<>|]/", '', $name);
|
||||||
if ($tmpName != $name) {
|
if ($tmpName != $name) {
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class UpdateFilesNameLengthTo200 extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('files', function (Blueprint $table) {
|
||||||
|
$table->string('name', 255)->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('files', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user