From: Shane Jaroch Date: Thu, 20 Mar 2025 18:58:40 +0000 (-0400) Subject: Fix panic/error raised by deleted passwords. (#71) X-Git-Url: https://git.nutra.tk/v1?a=commitdiff_plain;h=b6efa114ca04ede0822eaf9800f0e19a805d388d;p=gamesguru%2Fffpass.git Fix panic/error raised by deleted passwords. (#71) * Fix panic/error raised by deleted passwords. consider the following row entry, ```json {"id": 513, "guid": "{6a83e72d-8255-4bc0-ad1a-c292613fb55b}", "timePasswordChanged": 1740354999123, "syncCounter": 0, "everSynced": true, "deleted": true} ``` which leads to: ```text Traceback (most recent call last): File "ffpass", line 8, in sys.exit(main()) File "ffpass/__init__.py", line 419, in main args.func(args) File "ffpass/__init__.py", line 322, in main_export logins = exportLogins(key, jsonLogins) File "ffpass/__init__.py", line 212, in exportLogins encUsername = row["encryptedUsername"] KeyError: 'encryptedUsername' ``` NOTE: line numbers from a `pip install ffpass`, version: `ffpass-0.5.0` * update workflow to use `upload-artifact@v4` also: - actions/checkout@v4 - actions/setup-python@v5 * update EnricoMi/publish-unit-test-result-action@v2 --------- Co-authored-by: Louis Abraham --- diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index acf5e5f..24ddd97 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -7,36 +7,37 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + + - name: Test with pytest + run: | + pip install pytest + pip install pytest-cov + python -m pytest tests --junit-xml pytest.xml + + - name: Lint with flake8 + run: | + pip install flake8 + flake8 --ignore=E741,E501 . + + - name: Upload Unit Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Unit Test Results + path: pytest.xml - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install . - - - name: Test with pytest - run: | - pip install pytest - pip install pytest-cov - python -m pytest tests --junit-xml pytest.xml - - - name: Lint with flake8 - run: | - pip install flake8 - flake8 --ignore=E741,E501 . - - - name: Upload Unit Test Results - if: always() - uses: actions/upload-artifact@v4 - with: - name: Unit Test Results - path: pytest.xml publish-test-results: name: "Publish Unit Tests Results" diff --git a/ffpass/__init__.py b/ffpass/__init__.py index 49a3d62..56262cb 100644 --- a/ffpass/__init__.py +++ b/ffpass/__init__.py @@ -214,6 +214,8 @@ def exportLogins(key, jsonLogins): return [] logins = [] for row in jsonLogins["logins"]: + if row.get("deleted"): + continue encUsername = row["encryptedUsername"] encPassword = row["encryptedPassword"] logins.append(