Fix: Use proper URL building for Collabora WOPISrc parameter
- Changed from manual string concatenation to Uri.parse().replace(queryParameters: ...) - This properly encodes the WOPISrc while maintaining encoding through iframe.src - Fixes Collabora 'WOPISrc validation error: unencoded WOPISrc' warning - Uri API ensures query parameters are properly percent-encoded
This commit is contained in:
@@ -404,10 +404,12 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user