From a93008a204f83025166f215a3ca92555eeff2060 Mon Sep 17 00:00:00 2001 From: Aferdita Muriqi Date: Mon, 9 Sep 2019 15:06:44 -0400 Subject: [PATCH] changed encoding to replacement --- .../readium/r2/streamer/container/DirectoryContainer.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r2-streamer/src/main/java/org/readium/r2/streamer/container/DirectoryContainer.kt b/r2-streamer/src/main/java/org/readium/r2/streamer/container/DirectoryContainer.kt index ddb0c6ee..8849f7e3 100644 --- a/r2-streamer/src/main/java/org/readium/r2/streamer/container/DirectoryContainer.kt +++ b/r2-streamer/src/main/java/org/readium/r2/streamer/container/DirectoryContainer.kt @@ -13,14 +13,12 @@ import java.io.ByteArrayOutputStream import java.io.File import java.io.FileInputStream import java.net.URI -import java.net.URLEncoder interface DirectoryContainer : Container { override fun data(relativePath: String): ByteArray { - val encodedPath = URLEncoder.encode(relativePath, "UTF-8"); - val decodedFilePath = rootFile.rootPath + "/" + getDecodedRelativePath(encodedPath) + val decodedFilePath = rootFile.rootPath + "/" + getDecodedRelativePath(relativePath) val file = File(decodedFilePath) if (!file.exists()) @@ -45,7 +43,9 @@ interface DirectoryContainer : Container { FileInputStream(File(rootFile.toString() + "/" + getDecodedRelativePath(relativePath))) fun getDecodedRelativePath(relativePath: String): String { - return URI(relativePath).path + // val encodedPath = URLEncoder.encode(relativePath, "UTF-8"); + val replacedPath = relativePath.replace(" ", "%20") + return URI(replacedPath).path } }