From 09480d939013e0ebe9d8d89d57ae461d63c181d4 Mon Sep 17 00:00:00 2001 From: Mohamed Zenadi Date: Wed, 2 Aug 2017 00:48:45 +0100 Subject: Ensure that we have a single `/` --- app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index 6bfac55f..73c9f935 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -570,7 +570,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { * Gets the relative path to the repository */ fun getRelativePath(fullPath: String, repositoryPath: String): String = - fullPath.replace(repositoryPath, "").replace("//", "/") + fullPath.replace(repositoryPath, "").replace("/+".toRegex(), "/") /** * Gets the Parent path, relative to the repository @@ -578,7 +578,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { fun getParentPath(fullPath: String, repositoryPath: String) : String { val relativePath = getRelativePath(fullPath, repositoryPath) val index = relativePath.lastIndexOf("/") - return "/${relativePath.substring(startIndex = 0, endIndex = index + 1)}/".replace("//", "/") + return "/${relativePath.substring(startIndex = 0, endIndex = index + 1)}/".replace("/+".toRegex(), "/") } /** -- cgit v1.2.3