Fix document viewer: add dynamic base URL and debug logging for file downloads

This commit is contained in:
Leon Bösche
2026-01-10 05:21:43 +01:00
parent fa6ba846d8
commit f372172898
2 changed files with 32 additions and 4 deletions

View File

@@ -169,9 +169,16 @@ class _DocumentViewerModalState extends State<DocumentViewerModal> {
}
if (state is DocumentViewerReady) {
if (state.caps.isPdf) {
// Log the URL being used for debugging
print('Loading PDF from: ${state.viewUrl}');
print('Using token: ${state.token.substring(0, 20)}...');
return SfPdfViewer.network(
state.viewUrl.toString(),
headers: {'Authorization': 'Bearer ${state.token}'},
onDocumentLoadFailed: (details) {
print('PDF load failed: ${details.error}');
print('Description: ${details.description}');
},
);
} else {
return Container(