fix(image): 修复JPEG文件上传路径问题

- 从文件名中提取扩展名并标准化为小写
- 将.jpg扩展名统一转换为.jpeg
- 更新上传路径以包含正确的图像类型目录
- 保持原有公共读取权限设置
This commit is contained in:
2025-11-29 19:41:25 +08:00
parent 4e9aac4cf3
commit 1de760fc87

View File

@@ -89,9 +89,13 @@ public class UploadStage extends AbstractPipelineStage<PhotoProcessContext> {
private String uploadFile(IStorageAdapter adapter, File file) throws Exception { private String uploadFile(IStorageAdapter adapter, File file) throws Exception {
String filename = file.getName(); String filename = file.getName();
String extension = filename.substring(filename.lastIndexOf('.') + 1);
if (extension.equals("jpg")) {
extension = "jpeg";
}
String uploadPath = "print/" + filename; String uploadPath = "print/" + filename;
String url = adapter.uploadFile(uploadPath, file); String url = adapter.uploadFile("image/" + extension, file, uploadPath);
adapter.setAcl(StorageAcl.PUBLIC_READ, uploadPath); adapter.setAcl(StorageAcl.PUBLIC_READ, uploadPath);
return url; return url;