From 7dea7065369234ead9a36645101c3375d07b2be3 Mon Sep 17 00:00:00 2001 From: Dinakar <26552821+dinakar29@users.noreply.github.com> Date: Wed, 23 Feb 2022 07:22:20 -0600 Subject: [PATCH] Handle non-text file gracefully (#7) --- .github/ISSUE_TEMPLATE/bug.yml | 4 +--- presidio_cli/__init__.py | 2 +- presidio_cli/cli.py | 7 +++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 5e9cc31..21aa992 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -3,8 +3,6 @@ name: 🐞 Bug Report description: File a bug report title: "[Bug]: " labels: ["bug"] -assignees: - - insightsengineering/idr body: - type: markdown attributes: @@ -43,7 +41,7 @@ body: attributes: label: Relevant log output description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: python + render: Python - type: checkboxes id: terms attributes: diff --git a/presidio_cli/__init__.py b/presidio_cli/__init__.py index 6c8d9f4..32db3cf 100644 --- a/presidio_cli/__init__.py +++ b/presidio_cli/__init__.py @@ -2,7 +2,7 @@ APP_NAME = "presidio_cli" -APP_VERSION = "0.0.5" +APP_VERSION = "0.0.6" APP_DESCRIPTION = __doc__ SHELL_NAME = "presidio" diff --git a/presidio_cli/cli.py b/presidio_cli/cli.py index 027f161..70a6942 100644 --- a/presidio_cli/cli.py +++ b/presidio_cli/cli.py @@ -118,8 +118,11 @@ def find_files_recursively(items, conf): for root, dirnames, filenames in os.walk(item): for f in filenames: filepath = os.path.join(root, f) - if conf.is_text_file(filepath): - yield filepath + try: + if conf.is_text_file(filepath): + yield filepath + except UnicodeDecodeError: + pass # Found non-text data else: yield item