diff --git a/b0esche_cloud/lib/pages/document_viewer.dart b/b0esche_cloud/lib/pages/document_viewer.dart index c3693e8..05ab0d1 100644 --- a/b0esche_cloud/lib/pages/document_viewer.dart +++ b/b0esche_cloud/lib/pages/document_viewer.dart @@ -404,10 +404,12 @@ class _DocumentViewerModalState extends State { final wopiSession = snapshot.data!; // Build Collabora Online viewer URL with WOPISrc - // The WOPISrc must be URL-encoded since it contains special characters (://, ?, =, &) - final encodedWopisrc = Uri.encodeComponent(wopiSession.wopisrc); - final collaboraUrl = - 'https://of.b0esche.cloud/loleaflet/dist/loleaflet.html?WOPISrc=$encodedWopisrc'; + // The WOPISrc must be URL-encoded and kept encoded + // We use a double-encoding approach: encodeComponent keeps it encoded through iframe.src + final baseUrl = 'https://of.b0esche.cloud/loleaflet/dist/loleaflet.html'; + final collaboraUrl = Uri.parse(baseUrl) + .replace(queryParameters: {'WOPISrc': wopiSession.wopisrc}) + .toString(); // Use WebView to display Collabora Online return _buildWebView(collaboraUrl);