Skip to content

Commit c10b47d

Browse files
authored
Pass the unmodified login path to the native component instead of assuming .gpg (#312)
this is in support of <browserpass/browserpass-native#127>. this has immediate benefit for anyone using the patches shared in that PR today. without this, browserpass doesn't recognize `github.com.age` as a default key for `https://github.com`, because it fails the substring match. by stripping the extension -- whatever it is -- both `github.com.gpg` and `github.com.age` are recognized as keys for their intended domain.
1 parent 21f3431 commit c10b47d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ function hostAction(settings, action, params = {}) {
870870
async function parseFields(settings, login) {
871871
var response = await hostAction(settings, "fetch", {
872872
storeId: login.store.id,
873-
file: login.login + ".gpg",
873+
file: login.loginPath,
874874
});
875875
if (response.status != "ok") {
876876
throw new Error(JSON.stringify(response)); // TODO handle host error

src/helpers.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,14 @@ function prepareLogins(files, settings) {
8787
for (let storeId in files) {
8888
for (let key in files[storeId]) {
8989
// set login fields
90+
const loginPath = files[storeId][key];
91+
// remove the file-type extension
92+
const loginName = loginPath.replace(/\.[^.]+$/u, "");
9093
const login = {
9194
index: index++,
9295
store: settings.stores[storeId],
93-
login: files[storeId][key].replace(/\.gpg$/i, ""),
96+
login: loginName,
97+
loginPath: loginPath,
9498
allowFill: true,
9599
};
96100

0 commit comments

Comments
 (0)