Skip to content

Commit

Permalink
Merge pull request #47 from MeisterLabs/files-support
Browse files Browse the repository at this point in the history
initial attempt at files support
  • Loading branch information
martyn-meister authored Dec 14, 2023
2 parents e3a14a5 + 6921c55 commit 63c796b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ func fetchOnePasswordSecret(client connect.Client, secret *config.Secret) (Acces
return errorResponse, err
}
if len(split) > 4 {
// field or file
files, err := client.GetFiles(split[3], split[1])
if err != nil {
for i, file := range files {
if file.Name == split[4] {
content, err := client.GetFileContent(&files[i])
if err != nil {
return data2Response([]byte(content)), nil
}
}
}
}
for _, field := range item.Fields {
if field.Label == split[4] {
return data2Response([]byte(field.Value)), nil
Expand Down

0 comments on commit 63c796b

Please sign in to comment.