From 5c006da27d969061b824c3eb57c8587c884adc3f Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Sun, 2 Nov 2025 13:05:20 +0100
Subject: [PATCH] ui styles
---
.../mainNeutralizePlayground.py | 8 ++++++++
.../serviceSharepoint/mainServiceSharepoint.py | 18 ++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/modules/features/neutralizePlayground/mainNeutralizePlayground.py b/modules/features/neutralizePlayground/mainNeutralizePlayground.py
index d3b6d8a8..34b90673 100644
--- a/modules/features/neutralizePlayground/mainNeutralizePlayground.py
+++ b/modules/features/neutralizePlayground/mainNeutralizePlayground.py
@@ -201,7 +201,15 @@ class SharepointProcessor:
async def _matchConnectionToPath(self, connections: list, sharepointPath: str):
try:
+ if not sharepointPath or not sharepointPath.startswith('https://'):
+ logger.warning(f"Invalid sharepointPath for matching: {sharepointPath}")
+ return connections[0] if connections else None
+
targetDomain = urlparse(sharepointPath).netloc.lower()
+ if not targetDomain:
+ logger.warning(f"Could not extract domain from path: {sharepointPath}")
+ return connections[0] if connections else None
+
logger.info(f"Looking for connection matching domain: {targetDomain}")
for connection in connections:
diff --git a/modules/services/serviceSharepoint/mainServiceSharepoint.py b/modules/services/serviceSharepoint/mainServiceSharepoint.py
index dcce9894..70fc52ff 100644
--- a/modules/services/serviceSharepoint/mainServiceSharepoint.py
+++ b/modules/services/serviceSharepoint/mainServiceSharepoint.py
@@ -27,7 +27,7 @@ class SharepointService:
"""Set access token from UserConnection.
Args:
- userConnection: UserConnection object containing token information
+ userConnection: UserConnection object or dict containing token information
Returns:
bool: True if token was set successfully, False otherwise
@@ -37,15 +37,25 @@ class SharepointService:
logger.error("UserConnection is required to set access token")
return False
+ # Handle both dict and UserConnection object
+ if isinstance(userConnection, dict):
+ connectionId = userConnection.get('id')
+ else:
+ connectionId = getattr(userConnection, 'id', None)
+
+ if not connectionId:
+ logger.error("UserConnection must have an 'id' field")
+ return False
+
# Get a fresh token for this specific connection
from modules.security.tokenManager import TokenManager
- token = TokenManager().getFreshToken(userConnection.id)
+ token = TokenManager().getFreshToken(connectionId)
if not token:
- logger.error(f"No token found for connection {userConnection.id}")
+ logger.error(f"No token found for connection {connectionId}")
return False
self.accessToken = token.tokenAccess
- logger.info(f"Access token set for connection {userConnection.id}")
+ logger.info(f"Access token set for connection {connectionId}")
return True
except Exception as e: