Commit 5dc2e8ab authored by Liang Ding's avatar Liang Ding

🎨 改进文件名过滤

parent c2a66928
......@@ -54,7 +54,7 @@ import java.util.ResourceBundle;
* Solo utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.0.2, Mar 10, 2019
* @version 1.7.0.3, Mar 10, 2019
* @since 2.8.0
*/
public final class Solos {
......@@ -238,8 +238,9 @@ public final class Solos {
*/
public static String sanitizeFilename(final String unsanitized) {
return unsanitized.
replaceAll("[\\?\\\\/:|<>\\*\\[\\]]", "-"). // ? \ / : | < > * [ ] to -
replaceAll("\\s+", "-"); // white space to -
replaceAll("[^(a-zA-Z0-9\\u4e00-\\u9fa5\\.)]", "").
replaceAll("[\\?\\\\/:|<>\\*\\[\\]\\(\\)\\$%\\{\\}@~]", "").
replaceAll("\\s", "");
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment