Add image file handling in PublicFileViewer and update publicFileShareHandler for image viewing
This commit is contained in:
@@ -125,6 +125,11 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
return mimeType.toString().startsWith('audio/');
|
||||
}
|
||||
|
||||
bool _isImageFile() {
|
||||
final mimeType = _fileData?['capabilities']?['mimeType'] ?? '';
|
||||
return mimeType.toString().startsWith('image/');
|
||||
}
|
||||
|
||||
bool _isPdfFile() {
|
||||
final mimeType = _fileData?['capabilities']?['mimeType'] ?? '';
|
||||
return mimeType == 'application/pdf' ||
|
||||
@@ -208,6 +213,16 @@ class _PublicFileViewerState extends State<PublicFileViewer> {
|
||||
fileName: _fileData!['fileName'],
|
||||
viewerId: 'public-audio-${widget.token.hashCode}',
|
||||
);
|
||||
} else if (_isImageFile()) {
|
||||
return Expanded(
|
||||
child: FileViewerDispatch.buildFileViewer(
|
||||
context,
|
||||
viewUrl,
|
||||
_fileData?['capabilities']?['mimeType'],
|
||||
fileName: _fileData!['fileName'],
|
||||
viewerId: 'public-image-${widget.token.hashCode}',
|
||||
),
|
||||
);
|
||||
} else if (_isDocumentFile()) {
|
||||
if (kIsWeb) {
|
||||
// Use Collabora viewer for web
|
||||
|
||||
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
@@ -3006,7 +3006,7 @@ func publicFileShareHandler(w http.ResponseWriter, r *http.Request, db *database
|
||||
}
|
||||
|
||||
// Set view URL for PDFs, videos, audio, and documents (for inline viewing)
|
||||
if isPdf || strings.HasPrefix(mimeType, "video/") || strings.HasPrefix(mimeType, "audio/") {
|
||||
if isPdf || strings.HasPrefix(mimeType, "video/") || strings.HasPrefix(mimeType, "audio/") || strings.HasPrefix(mimeType, "image/") {
|
||||
viewerSession["viewUrl"] = viewPath
|
||||
} else if strings.Contains(mimeType, "document") || strings.Contains(mimeType, "word") || strings.Contains(mimeType, "spreadsheet") || strings.Contains(mimeType, "presentation") {
|
||||
// Use Collabora for document viewing
|
||||
|
||||
Reference in New Issue
Block a user