fixes #7918 - onepassword lookup fails if field name contains uppercase letters and section is specified (#7919)

* fix #7918

* Update plugins/lookup/onepassword.py

Co-authored-by: Sam Doran <github@samdoran.com>

* onepassword lookup: transform field ids to lowercase

* #7918: added unit tests

* #7919: add changelog fragment

* Update changelogs/fragments/7919-onepassword-fieldname-casing.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Sam Doran <github@samdoran.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Benjamin Mitzkus 2024-02-16 13:53:07 +01:00 committed by GitHub
commit 6088e2dc0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 277 additions and 2 deletions

View file

@ -489,10 +489,10 @@ class OnePassCLIv2(OnePassCLIBase):
current_section_title = section.get("label", section.get("id", "")).lower()
if section_title == current_section_title:
# In the correct section. Check "label" then "id" for the desired field_name
if field.get("label") == field_name:
if field.get("label", "").lower() == field_name:
return field.get("value", "")
if field.get("id") == field_name:
if field.get("id", "").lower() == field_name:
return field.get("value", "")
return ""