fix(测试跟踪): 禅道带特殊字符的图片同步失败
--bug=1013764 --user=陈建星 【测试跟踪】图片名称包含空格 从ms 同步到禅道 不显示 https://www.tapd.cn/55049933/s/1172358
This commit is contained in:
parent
d22a71fa8e
commit
2fe21fb79e
|
@ -16,8 +16,8 @@ public class ResourceController {
|
|||
@Resource
|
||||
ResourceService resourceService;
|
||||
@PostMapping(value = "/md/upload", consumes = {"multipart/form-data"})
|
||||
public void upload(@RequestPart(value = "request") MdUploadRequest request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
resourceService.mdUpload(request, file);
|
||||
public String upload(@RequestPart(value = "request") MdUploadRequest request, @RequestPart(value = "file", required = false) MultipartFile file) {
|
||||
return resourceService.mdUpload(request, file);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/md/get")
|
||||
|
|
|
@ -29,8 +29,10 @@ public class ResourceService {
|
|||
@Resource
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
public void mdUpload(MdUploadRequest request, MultipartFile file) {
|
||||
FileUtils.uploadFile(file, FileUtils.MD_IMAGE_DIR, request.getId() + "_" + request.getFileName());
|
||||
public String mdUpload(MdUploadRequest request, MultipartFile file) {
|
||||
String fileName = request.getId() + request.getFileName().substring(request.getFileName().lastIndexOf("."));
|
||||
FileUtils.uploadFile(file, FileUtils.MD_IMAGE_DIR, fileName);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public ResponseEntity<FileSystemResource> getMdImage(String name) {
|
||||
|
|
|
@ -164,9 +164,9 @@ export default {
|
|||
methods: {
|
||||
imgAdd(pos, file) {
|
||||
this.result.loading = true;
|
||||
uploadMarkDownImg(file, (response, param) => {
|
||||
uploadMarkDownImg(file, (data) => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
let url = '/resource/md/get?fileName=' + param.id + '_' + encodeURIComponent(param.fileName);
|
||||
let url = '/resource/md/get?fileName=' + data;
|
||||
this.$refs.md.$img2Url(pos, url);
|
||||
this.result.loading = false;
|
||||
});
|
||||
|
|
|
@ -7,11 +7,10 @@ export function uploadMarkDownImg(file, callback) {
|
|||
id: getUUID().substring(0, 8)
|
||||
};
|
||||
file.prefix = param.id;
|
||||
// 带括号和空格,可能无法展示
|
||||
param.fileName = file.name.replace("(", "").replace(")", "").replace(" ", "");
|
||||
param.fileName = file.name.substring(file.name.lastIndexOf('.'));
|
||||
return fileUpload('/resource/md/upload', file, null, param, (response) => {
|
||||
if (callback) {
|
||||
callback(response, param);
|
||||
callback(response.data, param);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue