Cleanup trailing temp files/folders (#2742)

* test: add missing afterClass to cleanup BRUT* directory

* fix: properly cleanup apkFile temp after buildManifest
This commit is contained in:
Connor Tumbleson 2022-01-17 07:19:22 -05:00 committed by GitHub
parent 86856a69d7
commit ddc4bb360a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -562,6 +562,8 @@ public class Androlib {
Directory tmpDir = new ExtFile(apkFile).getDirectory();
tmpDir.copyToDir(apkDir, APK_MANIFEST_FILENAMES);
apkFile.delete();
}
return true;
} catch (IOException | DirectoryException ex) {

View File

@ -26,6 +26,7 @@ import brut.directory.ExtFile;
import brut.util.BrutIO;
import brut.util.OS;
import brut.util.OSDetection;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@ -43,6 +44,11 @@ public class UnknownDirectoryTraversalTest extends BaseTest {
TestUtils.copyResourceDir(UnknownDirectoryTraversalTest.class, "util/traversal", sTmpDir);
}
@AfterClass
public static void afterClass() throws BrutException {
OS.rmdir(sTmpDir);
}
@Test
public void validFileTest() throws IOException, BrutException {
String validFilename = BrutIO.sanitizeUnknownFile(sTmpDir, "file");