process keys of any file extension -- not just .gpg
This commit is contained in:
@@ -2,7 +2,6 @@ package request
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/browserpass/browserpass-native/errors"
|
"github.com/browserpass/browserpass-native/errors"
|
||||||
"github.com/browserpass/browserpass-native/helpers"
|
"github.com/browserpass/browserpass-native/helpers"
|
||||||
@@ -13,18 +12,6 @@ import (
|
|||||||
func fetchDecryptedContents(request *request) {
|
func fetchDecryptedContents(request *request) {
|
||||||
responseData := response.MakeFetchResponse()
|
responseData := response.MakeFetchResponse()
|
||||||
|
|
||||||
if !strings.HasSuffix(request.File, ".gpg") {
|
|
||||||
log.Errorf("The requested password file '%v' does not have the expected '.gpg' extension", request.File)
|
|
||||||
response.SendErrorAndExit(
|
|
||||||
errors.CodeInvalidPasswordFileExtension,
|
|
||||||
&map[errors.Field]string{
|
|
||||||
errors.FieldMessage: "The requested password file does not have the expected '.gpg' extension",
|
|
||||||
errors.FieldAction: "fetch",
|
|
||||||
errors.FieldFile: request.File,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
store, ok := request.Settings.Stores[request.StoreID]
|
store, ok := request.Settings.Stores[request.StoreID]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Errorf(
|
log.Errorf(
|
||||||
|
@@ -36,7 +36,7 @@ func listFiles(request *request) {
|
|||||||
|
|
||||||
store.Path = normalizedStorePath
|
store.Path = normalizedStorePath
|
||||||
|
|
||||||
files, err := zglob.GlobFollowSymlinks(filepath.Join(store.Path, "/**/*.gpg"))
|
files, err := zglob.GlobFollowSymlinks(filepath.Join(store.Path, "/**/*"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf(
|
log.Errorf(
|
||||||
"Unable to list the files in the password store '%+v' at its location: %+v",
|
"Unable to list the files in the password store '%+v' at its location: %+v",
|
||||||
|
Reference in New Issue
Block a user