mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
fix(stores): handle Android storage aliases
This commit is contained in:
1 parent
9222a1fe4d
commit
1e23bb6d8d
2 files changed
+17
-1
No files matched your search
@@ -2,10 +2,12 @@ package com.droiddeck.launcher.stores.amazon
|
||||
|
||||
import java.io.File
|
||||
import java.security.MessageDigest
|
||||
import java.nio.file.Files
|
||||
import org.json.JSONObject
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Assume.assumeFalse
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
@@ -51,4 +53,17 @@ class AmazonEngineTest {
|
||||
File(malformed, "engine.json").writeText("not json")
|
||||
assertFalse(AmazonEngine.verify(malformed))
|
||||
}
|
||||
|
||||
@Test fun parentStorageAliasIsAllowedButLibrarySymlinkIsRejected() {
|
||||
assumeFalse(System.getProperty("os.name").startsWith("Windows"))
|
||||
val directory = prepared()
|
||||
val alias = File(temp.root, "alias")
|
||||
Files.createSymbolicLink(alias.toPath(), directory.toPath())
|
||||
assertTrue(AmazonEngine.verify(alias))
|
||||
val library = File(directory, "libdroiddeckamazon.so")
|
||||
val outside = temp.newFile("outside.so").apply { writeBytes(library.readBytes()) }
|
||||
library.delete()
|
||||
Files.createSymbolicLink(library.toPath(), outside.toPath())
|
||||
assertFalse(AmazonEngine.verify(directory))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user