Adding many more FileIcon types.

This commit is contained in:
Roland 2023-02-15 21:20:23 -07:00
parent b6eb888761
commit 7595e04dc9
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 20 additions and 2 deletions

View file

@ -66,6 +66,8 @@ export const FilePreviewContext = React.createContext({
previewFile: null, setPreviewFile: null, previewModal: null, setPreviewModal: null,
});
const MAXIMUM_TEXT_SIZE = 5_000_000;
export function FilePreviewWrapper({children}) {
const [previewFile, setPreviewFile] = React.useState(null);
const [previewModal, setPreviewModal] = React.useState(null);
@ -102,7 +104,7 @@ export function FilePreviewWrapper({children}) {
console.debug(`useFilePreview path=${previewFile['path']} mimetype=${mimetype}`);
const url = getMediaPathURL(previewFile);
const downloadURL = getDownloadPathURL(previewFile);
if (mimetype.startsWith('text/') && size >= 10000) {
if (mimetype.startsWith('text/') && size > MAXIMUM_TEXT_SIZE) {
// Large text files should be downloaded.
window.open(downloadURL);
} else if (mimetype.startsWith('text/') || mimetype.startsWith('application/json')) {