whyclxw
2025-02-27 1fb20e784af96284eca2bcd04f5e31a83026988f
软件上传源码和下载
1个文件已修改
6 ■■■■ 已修改文件
src/main/java/com/whyc/service/SoftcodeService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SoftcodeService.java
@@ -75,11 +75,11 @@
        wrapper.last("limit 1");
        Softcode softcode=mapper.selectOne(wrapper);
        String filename=softcode.getCodeUrl().substring(softcode.getCodeUrl().lastIndexOf("\\")+1);
        String name=softcode.getCodeUrl().substring(softcode.getCodeUrl().lastIndexOf("\\")+1);
        try {
            // 转码防止乱码
            //resp.addHeader("Content-Disposition", "attachment;filename=" + new String(softwareName.getBytes("UTF-8"), "ISO8859-1"));
            resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode (filename, "utf-8"));
            resp.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode (name, "utf-8"));
            OutputStream out = resp.getOutputStream();
            FileInputStream in = new FileInputStream(fileDirName+ File.separator+softcode.getCodeUrl());
            int len=0;
@@ -97,6 +97,6 @@
        }
        //记录日志
        logService.recordOperationLogDownLoad(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD_SOFWARE.getType(),new Date(),req.getRemoteAddr()
                ,filename,fileDirName+File.separator+softcode.getCodeUrl(),"",fileName,"");
                ,name,fileDirName+File.separator+softcode.getCodeUrl(),"",name,"");
    }
}