Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan committed May 26, 2018
1 parent d60b79e commit b9a96ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/MyHttp.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function rename($key, $newKey)
$res = $client->post($this->api, $this->appendSign(array(
'action' => 'move',
'key' => $key,
'newKey' => $key,
'newKey' => $newKey,
)));

$this->error = $res->getBody();
Expand All @@ -121,7 +121,7 @@ public function copy($key, $newKey)
$res = $client->post($this->api, $this->appendSign(array(
'action' => 'copy',
'key' => $key,
'newKey' => $key,
'newKey' => $newKey,
)));

$this->error = $res->getBody();
Expand Down
6 changes: 3 additions & 3 deletions src/MyHttpTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ private function _doUpload(Request $request)
private function checkFilename($filename)
{
// 必须限定在baseDir目录内,不能出现 ..
// (\w+\/)* 目录可有可无
// \w+ 文件名必须有
// ([\w\-]+\/)* 目录可有可无 (字母 数字 下划线 中杠)
// [\w\-]+ 文件名必须有
// (\.\w+)* 扩展名可有可无
if (!preg_match('/^(\w+\/)*\w+(\.\w+)*$/', $filename)) {
if (!preg_match('/^([\w\-]+\/)*[\w\-]+(\.\w+)*$/', $filename)) {
throw new \Exception('filename error');
}
}
Expand Down

0 comments on commit b9a96ac

Please sign in to comment.