mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Fix Syncmatica file name
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.leavesmc.leaves.protocol.syncmatica;
|
package org.leavesmc.leaves.protocol.syncmatica;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.LeavesConfig;
|
import org.leavesmc.leaves.LeavesConfig;
|
||||||
|
|
||||||
@@ -8,7 +9,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -84,7 +84,7 @@ public class SyncmaticaProtocol {
|
|||||||
public static String sanitizeFileName(final @NotNull String badFileName) {
|
public static String sanitizeFileName(final @NotNull String badFileName) {
|
||||||
String input = badFileName;
|
String input = badFileName;
|
||||||
try {
|
try {
|
||||||
input = Paths.get(input).getFileName().toString();
|
input = FilenameUtils.getName(input);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
final StringBuilder sanitized = new StringBuilder();
|
final StringBuilder sanitized = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user