From c68d90b9e68d386673dc7161fcca93b00383cbc6 Mon Sep 17 00:00:00 2001 From: Julian Dominguez-Schatz Date: Tue, 17 Dec 2024 23:27:59 -0500 Subject: [PATCH] PR feedback: security --- .../workflows/i18n-string-extract-master.yml | 19 ++++++++++--------- packages/desktop-client/src/i18n.ts | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/i18n-string-extract-master.yml b/.github/workflows/i18n-string-extract-master.yml index 73258acbc40..ed413cd4703 100644 --- a/.github/workflows/i18n-string-extract-master.yml +++ b/.github/workflows/i18n-string-extract-master.yml @@ -16,14 +16,6 @@ jobs: - name: Configure i18n client run: | pip install wlc - mkdir -p ~/.config - cat <~/.config/weblate - [weblate] - url = https://hosted.weblate.org/api/ - key = ${{ secrets.WEBLATE_API_KEY_CI_STRINGS }} - translation = actualbudget/actual/en - EOF - chmod 600 ~/.config/weblate - name: Generate i18n strings run: yarn generate:i18n - name: Upload i18n strings @@ -32,4 +24,13 @@ jobs: echo "File packages/desktop-client/locale/en.json not found. Ensure the file was generated correctly." exit 1 fi - wlc upload --author-name "Actual Budget" --author-email "dev@actualbudget.org" --method add --input packages/desktop-client/locale/en.json + wlc \ + --url https://hosted.weblate.org/api/ \ + --key "${{ secrets.WEBLATE_API_KEY_CI_STRINGS }}" \ + upload \ + --author-name "Actual Budget" \ + --author-email "dev@actualbudget.org" \ + --method add \ + --input packages/desktop-client/locale/en.json \ + actualbudget/actual/en + echo "Translations uploaded" diff --git a/packages/desktop-client/src/i18n.ts b/packages/desktop-client/src/i18n.ts index bc2934660c0..27af3ecac8c 100644 --- a/packages/desktop-client/src/i18n.ts +++ b/packages/desktop-client/src/i18n.ts @@ -7,7 +7,7 @@ const languages = import.meta.glob('/locale/*.json'); const loadLanguage = (language: string) => { const path = `/locale/${language}.json`; - if (!languages.hasOwnProperty(path)) { + if (!Object.hasOwn(languages, path)) { console.error(`Unknown locale ${language}`); throw new Error(`Unknown locale ${language}`); }