强制将HTTP替换为HTTPS

This commit is contained in:
2025-11-25 14:51:10 +08:00
parent 1e9e815314
commit bf182ebc89
4 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,5 @@
package com.fuyuanshen.app.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import com.fuyuanshen.app.service.AudioProcessService;
import com.fuyuanshen.app.service.VideoProcessService;
import com.fuyuanshen.common.core.domain.R;
@ -14,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Base64;
import java.util.List;
import java.util.concurrent.TimeUnit;
@ -74,4 +72,5 @@ public class AppVideoController extends BaseController {
public R<String> extract(@RequestParam("file") MultipartFile file) throws Exception {
return R.ok("Success", audioProcessService.extract(file));
}
}

View File

@ -286,6 +286,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
if (deviceForm.getFile() != null) {
String fileHash = fileHashUtil.hash(deviceForm.getFile());
SysOssVo upload = ossService.updateHash(deviceForm.getFile(), fileHash);
// 强制将HTTP替换为HTTPS
if (upload.getUrl() != null && upload.getUrl().startsWith("http://")) {
upload.setUrl(upload.getUrl().replaceFirst("^http://", "https://"));
}
// 设置图片路径
deviceForm.setDevicePic(upload.getUrl());
}

View File

@ -51,6 +51,7 @@ public class SysOss extends TenantEntity {
* 服务商
*/
private String service;
/**
* 内容哈希
*/