Skip to content

Commit b2eae2c

Browse files
authored
[PM-13513] Keeping "androidapp" scheme on uri when saving from Android Apps (#4420)
1 parent 7da1e48 commit b2eae2c

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

app/src/main/java/com/x8bit/bitwarden/data/autofill/util/AutofillRequestExtensions.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fun AutofillRequest.Fillable.toAutofillSaveItem(): AutofillSaveItem =
2424
.uri
2525
?.replace("https://", "")
2626
?.replace("http://", "")
27-
?.replace("androidapp://", "")
2827

2928
AutofillSaveItem.Login(
3029
username = partition.usernameSaveValue,

app/src/test/java/com/x8bit/bitwarden/data/autofill/util/AutofillRequestExtensionsTest.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,30 @@ class AutofillRequestExtensionsTest {
7575
assertEquals(expected, actual)
7676
}
7777
}
78+
79+
@Test
80+
fun `toAutofillSaveItem should return AutofillSaveItem Login with androidapp on URI`() {
81+
82+
val autofillPartition: AutofillPartition.Login = mockk {
83+
every { usernameSaveValue } returns SAVE_VALUE_USERNAME
84+
every { passwordSaveValue } returns SAVE_VALUE_PASSWORD
85+
}
86+
val autofillRequest: AutofillRequest.Fillable = mockk {
87+
every { partition } returns autofillPartition
88+
every { uri } returns RAW_ANDROIDAPP_URI
89+
}
90+
val expected = AutofillSaveItem.Login(
91+
username = SAVE_VALUE_USERNAME,
92+
password = SAVE_VALUE_PASSWORD,
93+
uri = RAW_ANDROIDAPP_URI,
94+
)
95+
96+
// Test
97+
val actual = autofillRequest.toAutofillSaveItem()
98+
99+
// Verify
100+
assertEquals(expected, actual)
101+
}
78102
}
79103

80104
private const val AUTOFILL_REQUEST_EXTENSIONS_PATH =
@@ -91,7 +115,7 @@ private const val SAVE_VALUE_PASSWORD: String = "SAVE_VALUE_PASSWORD"
91115
private const val SAVE_VALUE_USERNAME: String = "SAVE_VALUE_USERNAME"
92116
private const val FINAL_URI: String = "URI"
93117
private val RAW_URI_LIST: List<String> = listOf(
94-
"androidapp://URI",
95118
"https://URI",
96119
"http://URI",
97120
)
121+
private const val RAW_ANDROIDAPP_URI: String = "androidapp://URI"

0 commit comments

Comments
 (0)