Merge pull request #6514 from dataease/pr@dev@fix_svg-img

fix(仪表板): 修复不支持SVG矢量图上传问题 #5233 #5013
This commit is contained in:
王嘉豪 2023-11-02 15:11:26 +08:00 committed by GitHub
commit d83fa9f307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 10 deletions

View File

@ -60,16 +60,15 @@ public class StaticResourceService {
}
private boolean isImage(MultipartFile file) {
BufferedImage image = null;
try (InputStream input = file.getInputStream()) {
image = ImageIO.read(input);
ImageIO.read(input);
} catch (IOException e) {
LogUtil.error(e.getMessage(), e);
return false;
}
Pattern pattern = Pattern.compile("\\.(png|jpg|jpeg|gif)$");
Pattern pattern = Pattern.compile("\\.(png|jpg|jpeg|gif|svg)$");
Matcher matcher = pattern.matcher(file.getOriginalFilename().toLowerCase());
if (image == null || image.getWidth() <= 0 || image.getHeight() <= 0 || !matcher.find()) {
if (!matcher.find()) {
return false;
}

View File

@ -2064,7 +2064,7 @@ export default {
panel_cache_use_tips: 'It was checked that the last dashboard could not be saved normally. Do you want to use the panel that was not saved last time?',
template_name_tips: 'Panel\'s name should not be null',
panel_background_item: 'Customize panel background',
panel_background_image_tips: 'Currently.Jpeg,.Jpg,.Png,.Gif files are supported, and the size should not exceed 15m',
panel_background_image_tips: 'Currently Jpeg,Jpg,Png,Gif,Svg files are supported, and the size should not exceed 15m',
reUpload: 'reUpload',
create_by: 'Create By',
create_time: 'Create Time',

View File

@ -2058,7 +2058,7 @@ export default {
panel_cache_use_tips: '檢查到上次有儀表板未能正常保存,是否使用上次未保存的儀表板?',
template_name_tips: '儀表板名稱必填',
panel_background_item: '自定義儀表板背景',
panel_background_image_tips: '當前支持.jpeg,.jpg,.png,.gif文件,大小不要超過15M',
panel_background_image_tips: '當前支持jpeg,jpg,png,gif,svg文件,大小15M',
reUpload: '重新上傳',
create_by: '創建人',
create_time: '創建時間',

View File

@ -2058,7 +2058,7 @@ export default {
panel_cache_use_tips: '检查到上次有仪表板未能正常保存,是否使用上次未保存的仪表板?',
template_name_tips: '仪表板名称必填',
panel_background_item: '自定义仪表板背景',
panel_background_image_tips: '当前支持.jpeg,.jpg,.png,.gif文件,大小不要超过15M',
panel_background_image_tips: '当前支持jpeg,jpg,png,gif,svg文件,大小15M',
reUpload: '重新上传',
create_by: '创建人',
create_time: '创建时间',

View File

@ -110,7 +110,7 @@
<el-col style="width: 130px!important;">
<el-upload
action=""
accept=".jpeg,.jpg,.png,.gif"
accept=".jpeg,.jpg,.png,.gif,.svg"
class="avatar-uploader"
list-type="picture-card"
:class="{disabled:uploadDisabled}"

View File

@ -50,7 +50,7 @@
>
<el-upload
action=""
accept=".jpeg,.jpg,.png,.gif"
accept=".jpeg,.jpg,.png,.gif,.svg"
class="avatar-uploader"
list-type="picture-card"
:http-request="upload"

View File

@ -51,7 +51,7 @@
>
<el-upload
action=""
accept=".jpeg,.jpg,.png,.gif"
accept=".jpeg,.jpg,.png,.gif,.svg"
class="avatar-uploader"
list-type="picture-card"
:http-request="upload"