This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/develop by this push:
     new f29a74da AIRAVATA-3697 log error if filesystemencoding isn't 'utf-8'
f29a74da is described below

commit f29a74da5994561f6bec89df39db6a72f54128ab
Author: Marcus Christie <[email protected]>
AuthorDate: Fri Apr 28 15:26:46 2023 -0400

    AIRAVATA-3697 log error if filesystemencoding isn't 'utf-8'
---
 django_airavata/apps/api/exceptions.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/django_airavata/apps/api/exceptions.py 
b/django_airavata/apps/api/exceptions.py
index 557e7605..7d26a571 100644
--- a/django_airavata/apps/api/exceptions.py
+++ b/django_airavata/apps/api/exceptions.py
@@ -1,4 +1,5 @@
 import logging
+import sys
 
 from airavata.api.error.ttypes import (
     AuthorizationException,
@@ -58,6 +59,11 @@ def custom_exception_handler(exc, context):
         if response is not None:
             response.data['is_authenticated'] = False
 
+    if isinstance(exc, UnicodeEncodeError):
+        fse = sys.getfilesystemencoding()
+        if fse != 'utf-8':
+            log.error(f"filesystem encoding is {fse}, not 'utf-8'. File paths 
with Unicode characters will produce errors.")
+
     # Generic handler
     if response is None:
         log.error("API exception", exc_info=exc, extra={'request': 
context['request']})

Reply via email to