Skip to content

Commit

Permalink
pass the unmodified login path to the native component instead of ass…
Browse files Browse the repository at this point in the history
…uming .gpg

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.aaakk.us.kg.age` as a
default key for `https://github.com`, because it fails the substring
match. by stripping the extension -- whatever it is -- both
`github.aaakk.us.kg.gpg` and `github.aaakk.us.kg.age` are recognized as keys for their
intended domain.
  • Loading branch information
uninsane committed Nov 22, 2022
1 parent 21f3431 commit e36da97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ function hostAction(settings, action, params = {}) {
async function parseFields(settings, login) {
var response = await hostAction(settings, "fetch", {
storeId: login.store.id,
file: login.login + ".gpg",
file: login.loginPath,
});
if (response.status != "ok") {
throw new Error(JSON.stringify(response)); // TODO handle host error
Expand Down
6 changes: 5 additions & 1 deletion src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ function prepareLogins(files, settings) {
for (let storeId in files) {
for (let key in files[storeId]) {
// set login fields
const loginPath = files[storeId][key];
const lastDot = loginPath.lastIndexOf(".");
const loginName = lastDot < 0 ? loginPath : loginPath.substr(0, lastDot);
const login = {
index: index++,
store: settings.stores[storeId],
login: files[storeId][key].replace(/\.gpg$/i, ""),
login: loginName,
loginPath: loginPath,
allowFill: true,
};

Expand Down

0 comments on commit e36da97

Please sign in to comment.