mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
Merge pull request #5327 from sleuthkit/release-4.13.0
Merge release-4.13.0 into develop
This commit is contained in:
commit
081ae44ff5
@ -20,8 +20,6 @@ package org.sleuthkit.autopsy.coreutils;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.openide.filesystems.FileObject;
|
import org.openide.filesystems.FileObject;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@ -172,19 +170,7 @@ public class FileUtil {
|
|||||||
//for now escaping /:"*?<>| (not valid in file name, at least on Windows)
|
//for now escaping /:"*?<>| (not valid in file name, at least on Windows)
|
||||||
//with underscores. We are only keeping \ as it could be part of the path.
|
//with underscores. We are only keeping \ as it could be part of the path.
|
||||||
return fileName.replaceAll("[\\p{Cntrl}/:\"*?<>|]+", "_");
|
return fileName.replaceAll("[\\p{Cntrl}/:\"*?<>|]+", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* UTF-8 sanitize and escape special characters in a file name or a file name component
|
|
||||||
*
|
|
||||||
* @param fileName to escape
|
|
||||||
*
|
|
||||||
* @return Sanitized string
|
|
||||||
*/
|
|
||||||
public static String utf8SanitizeFileName(String fileName) {
|
|
||||||
Charset charset = StandardCharsets.UTF_8;
|
|
||||||
return charset.decode(charset.encode(escapeFileName(fileName))).toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the current user has read and write access to the dirPath.
|
* Test if the current user has read and write access to the dirPath.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user