mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Always delete temporary files on exit
This commit is contained in:
parent
0624d6a808
commit
6bd857ad8b
2 changed files with 3 additions and 2 deletions
|
@ -2141,7 +2141,6 @@ public class Manager implements Closeable {
|
||||||
GroupsV2Operations.GroupOperations groupOperations = groupsV2Operations.forGroup(groupSecretParams);
|
GroupsV2Operations.GroupOperations groupOperations = groupsV2Operations.forGroup(groupSecretParams);
|
||||||
|
|
||||||
File tmpFile = IOUtils.createTempFile();
|
File tmpFile = IOUtils.createTempFile();
|
||||||
tmpFile.deleteOnExit();
|
|
||||||
try (InputStream input = messageReceiver.retrieveGroupsV2ProfileAvatar(cdnKey,
|
try (InputStream input = messageReceiver.retrieveGroupsV2ProfileAvatar(cdnKey,
|
||||||
tmpFile,
|
tmpFile,
|
||||||
ServiceConfig.AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE)) {
|
ServiceConfig.AVATAR_DOWNLOAD_FAILSAFE_MAX_SIZE)) {
|
||||||
|
|
|
@ -22,7 +22,9 @@ import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
|
||||||
public class IOUtils {
|
public class IOUtils {
|
||||||
|
|
||||||
public static File createTempFile() throws IOException {
|
public static File createTempFile() throws IOException {
|
||||||
return File.createTempFile("signal_tmp_", ".tmp");
|
final File tempFile = File.createTempFile("signal-cli_tmp_", ".tmp");
|
||||||
|
tempFile.deleteOnExit();
|
||||||
|
return tempFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte[] readFully(InputStream in) throws IOException {
|
public static byte[] readFully(InputStream in) throws IOException {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue