1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 12:59:36 +02:00

Potential fix for code scanning alert no. 21: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
Sean Morley 2025-06-05 15:10:41 -04:00 committed by GitHub
parent 16840a6040
commit af5be0bc8f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,8 @@ from adventures.models import AdventureImage
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
logger = logging.getLogger(__name__)
class IntegrationView(viewsets.ViewSet):
permission_classes = [IsAuthenticated]
def list(self, request):
@ -420,9 +422,11 @@ class ImmichIntegrationViewSet(viewsets.ModelViewSet):
except requests.exceptions.SSLError:
return False, original_server_url, "SSL certificate error - check server certificate"
except requests.exceptions.RequestException as e:
return False, original_server_url, f"Connection failed: {str(e)}"
logger.error(f"RequestException during Immich connection validation: {str(e)}")
return False, original_server_url, "Connection failed due to a network error."
except Exception as e:
return False, original_server_url, f"Unexpected error: {str(e)}"
logger.error(f"Unexpected error during Immich connection validation: {str(e)}")
return False, original_server_url, "An unexpected error occurred while validating the connection."
# If we get here, none of the endpoints worked
return False, original_server_url, "Immich server endpoint not found - check server URL"