Update CORS handling for web image viewing and adjust host assignment in publicFileShareHandler

This commit is contained in:
Leon Bösche
2026-01-25 20:06:38 +01:00
parent ce29077e8c
commit ad882ae509
3 changed files with 7 additions and 4 deletions

View File

@@ -105,8 +105,8 @@ class FileViewerDispatch {
);
} else if (mimeType.startsWith('image/')) {
Widget child;
if (kIsWeb) {
// Use HTML img element for web to handle CORS
if (kIsWeb && token == null) {
// Use HTML img element for web public shares to handle CORS
ui_web.platformViewRegistry.registerViewFactory(viewerId, (int viewId) {
final imgElement = web.HTMLImageElement()
..src = url
@@ -124,7 +124,7 @@ class FileViewerDispatch {
child = HtmlElementView(viewType: viewerId);
} else {
// For mobile, use Image.network
// For mobile or authenticated web, use Image.network with headers
child = Image.network(
url,
headers: headers,