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 (#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.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 authored Nov 24, 2022
1 parent 21f3431 commit c10b47d
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];
// remove the file-type extension
const loginName = loginPath.replace(/\.[^.]+$/u, "");
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 c10b47d

Please sign in to comment.