fix(music): 修复音乐和封面上传路径问题
- 将音乐和封面的物理路径转换为相对于项目目录的路径 - 使用 '/' 替换系统文件分隔符,确保路径格式一致
This commit is contained in:
@@ -368,7 +368,8 @@ public class MusicServiceImpl implements MusicService {
|
||||
}
|
||||
|
||||
// 上传新文件
|
||||
String musicUrl = fileService.uploadMusic(file);
|
||||
String musicPhysicalPath = fileService.uploadMusic(file);
|
||||
String musicUrl = musicPhysicalPath.replace(System.getProperty("user.dir") + File.separator + "music-houduan", "").replace(File.separator, "/");
|
||||
music.setUrl(musicUrl);
|
||||
}
|
||||
|
||||
@@ -380,7 +381,8 @@ public class MusicServiceImpl implements MusicService {
|
||||
}
|
||||
|
||||
// 上传新封面
|
||||
String coverUrl = fileService.uploadImage(cover);
|
||||
String coverPhysicalPath = fileService.uploadImage(cover);
|
||||
String coverUrl = coverPhysicalPath.replace(System.getProperty("user.dir") + File.separator + "music-houduan", "").replace(File.separator, "/");
|
||||
music.setCover(coverUrl);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user