处理问题

This commit is contained in:
wanggeng 2022-09-07 23:00:20 +08:00
parent e51ffd3aa0
commit 06b63594b8

View File

@ -87,11 +87,8 @@ public class FileComponent {
*/ */
public String getFileUrl(String uploadPath) { public String getFileUrl(String uploadPath) {
String fileUrl = uploadPath.replace(fileProperties.getUploadPath(), ""); String fileUrl = uploadPath.replace(fileProperties.getUploadPath(), "");
if ("\\".equals(File.separator)) {
fileUrl = fileUrl.replace("\\", "/");
}
if (fileUrl.startsWith("/")) { if (fileUrl.startsWith("/")) {
fileUrl = fileUrl.substring(1, fileUrl.length() - 1); fileUrl = fileUrl.substring(1);
} }
return "files/" + fileUrl; return "files/" + fileUrl;
} }