编辑器粘贴优化

This commit is contained in:
Devil 2021-07-28 20:55:54 +08:00
parent 97826ae88b
commit 48107a7453

View File

@ -350,7 +350,8 @@ class Uploader
$imgUrl = str_replace("&", "&", $imgUrl);
//检查是否不允许的文件格式
if (!$this->checkType()) {
$ext = explode('?', strtolower(strrchr($imgUrl, '.')));
if (!$this->checkType($ext[0])) {
$this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED");
return;
}
@ -502,9 +503,10 @@ class Uploader
* 文件类型检测
* @return bool
*/
private function checkType()
private function checkType($ext = null)
{
return in_array($this->getFileExt(), $this->config["allowFiles"]);
$ext = empty($ext) ? $this->getFileExt() : $ext;
return in_array($ext, $this->config["allowFiles"]);
}
/**