| | |
| | | import javax.crypto.SecretKey; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | } |
| | | String domain = StringUtils.trimTrailingCharacter(properties.getDomain(), '/'); |
| | | String prefix = properties.getUrlPrefix().startsWith("/") ? properties.getUrlPrefix() : "/" + properties.getUrlPrefix(); |
| | | String baseUrl = domain + prefix + actionPath + uidFilename; |
| | | // 文件名可能包含中文、空格等字符,必须编码后再拼接到 URL,否则部分客户端/容器会直接返回 400 |
| | | String encodedUidFilename = URLEncoder.encode(uidFilename, StandardCharsets.UTF_8) |
| | | .replace("+", "%20"); |
| | | String baseUrl = domain + prefix + actionPath + encodedUidFilename; |
| | | |
| | | // -1 表示永久有效,不生成 token,改为 publicKey 组合校验 |
| | | if (expired != null && BigDecimal.valueOf(-1L).compareTo(expired) == 0) { |