mirror of https://gitee.com/stylefeng/roses
【file】更新文件渲染url增加考虑context-path问题
parent
4b702db3e4
commit
ef85da98d2
|
@ -29,6 +29,7 @@ import cn.stylefeng.roses.kernel.file.util.DownloadUtil;
|
|||
import cn.stylefeng.roses.kernel.file.util.PdfFileTypeUtil;
|
||||
import cn.stylefeng.roses.kernel.file.util.PicFileTypeUtil;
|
||||
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
|
||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
|
@ -365,7 +366,10 @@ public class SysFileInfoServiceImpl extends ServiceImpl<SysFileInfoMapper, SysFi
|
|||
// 获取登录用户的token
|
||||
String token = LoginContext.me().getToken();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileId=" + fileId + "&token=" + token;
|
||||
// 获取context-path
|
||||
String contextPath = HttpServletUtil.getRequest().getContextPath();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileId=" + fileId + "&token=" + token;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@ import cn.stylefeng.roses.kernel.file.exception.FileException;
|
|||
import cn.stylefeng.roses.kernel.file.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.expander.FileConfigExpander;
|
||||
import cn.stylefeng.roses.kernel.file.pojo.props.LocalFileProperties;
|
||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
@ -151,7 +152,10 @@ public class LocalFileOperator implements FileOperatorApi {
|
|||
// 获取登录用户的token
|
||||
String token = LoginContext.me().getToken();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileBucket=" + bucketName + "&fileObjectName=" + key + "&token=" + token;
|
||||
// 获取context-path
|
||||
String contextPath = HttpServletUtil.getRequest().getContextPath();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileBucket=" + bucketName + "&fileObjectName=" + key + "&token=" + token;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,6 +12,7 @@ import cn.stylefeng.roses.kernel.file.exception.FileException;
|
|||
import cn.stylefeng.roses.kernel.file.exception.enums.FileExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.file.expander.FileConfigExpander;
|
||||
import cn.stylefeng.roses.kernel.file.pojo.props.MinIoProperties;
|
||||
import cn.stylefeng.roses.kernel.rule.util.HttpServletUtil;
|
||||
import io.minio.MinioClient;
|
||||
import io.minio.errors.InvalidEndpointException;
|
||||
import io.minio.errors.InvalidPortException;
|
||||
|
@ -195,7 +196,10 @@ public class MinIoFileOperator implements FileOperatorApi {
|
|||
// 获取登录用户的token
|
||||
String token = LoginContext.me().getToken();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileBucket=" + bucketName + "&fileObjectName=" + key + "&token=" + token;
|
||||
// 获取context-path
|
||||
String contextPath = HttpServletUtil.getRequest().getContextPath();
|
||||
|
||||
return FileConfigExpander.getServerDeployHost() + contextPath + FileConstants.FILE_PRIVATE_PREVIEW_URL + "?fileBucket=" + bucketName + "&fileObjectName=" + key + "&token=" + token;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue