Add new allowed trust center file types
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -38,6 +38,23 @@ type ContextType = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const acceptedFileTypes = {
|
||||||
|
"application/json": [".json"],
|
||||||
|
"application/msword": [".doc"],
|
||||||
|
"application/pdf": [".pdf"],
|
||||||
|
"application/vnd.ms-excel": [".xls"],
|
||||||
|
"application/vnd.ms-powerpoint": [".ppt"],
|
||||||
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [".pptx"],
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
||||||
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
||||||
|
"image/jpeg": [".jpeg", ".jpg"],
|
||||||
|
"image/png": [".png"],
|
||||||
|
"image/svg+xml": [".svg"],
|
||||||
|
"image/webp": [".webp"],
|
||||||
|
"text/csv": [".csv"],
|
||||||
|
"text/markdown": [".md"],
|
||||||
|
}
|
||||||
|
|
||||||
export default function TrustCenterFilesTab() {
|
export default function TrustCenterFilesTab() {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const { organization } = useOutletContext<ContextType>();
|
const { organization } = useOutletContext<ContextType>();
|
||||||
@@ -80,10 +97,10 @@ export default function TrustCenterFilesTab() {
|
|||||||
if (acceptedFiles.length > 0) {
|
if (acceptedFiles.length > 0) {
|
||||||
const file = acceptedFiles[0];
|
const file = acceptedFiles[0];
|
||||||
|
|
||||||
if (file.type !== "application/pdf") {
|
if (!Object.keys(acceptedFileTypes).includes(file.type)) {
|
||||||
createForm.setError("root", {
|
createForm.setError("root", {
|
||||||
type: "manual",
|
type: "manual",
|
||||||
message: __("Only PDF files are allowed"),
|
message: __("File type is not allowed"),
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -225,11 +242,11 @@ export default function TrustCenterFilesTab() {
|
|||||||
<form onSubmit={handleCreate}>
|
<form onSubmit={handleCreate}>
|
||||||
<DialogContent padded className="space-y-4">
|
<DialogContent padded className="space-y-4">
|
||||||
<Dropzone
|
<Dropzone
|
||||||
description={__("Upload PDF file (max 10MB)")}
|
description={__("Upload file (max 10MB)")}
|
||||||
isUploading={isUploading}
|
isUploading={isUploading}
|
||||||
onDrop={handleFileUpload}
|
onDrop={handleFileUpload}
|
||||||
maxSize={10}
|
maxSize={10}
|
||||||
accept={{ "application/pdf": [".pdf"] }}
|
accept={acceptedFileTypes}
|
||||||
/>
|
/>
|
||||||
{uploadedFile && (
|
{uploadedFile && (
|
||||||
<div className="text-sm text-txt-secondary">
|
<div className="text-sm text-txt-secondary">
|
||||||
|
|||||||
@@ -1742,11 +1742,7 @@ func (s *DocumentService) Export(
|
|||||||
return fmt.Errorf("cannot load document version for %q: %w", documentID, err)
|
return fmt.Errorf("cannot load document version for %q: %w", documentID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pdfOptions := ExportPDFOptions{
|
pdfOptions := ExportPDFOptions(options)
|
||||||
WithWatermark: options.WithWatermark,
|
|
||||||
WatermarkEmail: options.WatermarkEmail,
|
|
||||||
WithSignatures: options.WithSignatures,
|
|
||||||
}
|
|
||||||
|
|
||||||
exportedPDF, err := exportDocumentPDF(
|
exportedPDF, err := exportDocumentPDF(
|
||||||
ctx,
|
ctx,
|
||||||
|
|||||||
@@ -222,10 +222,37 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService {
|
|||||||
fileValidator: &filevalidation.FileValidator{
|
fileValidator: &filevalidation.FileValidator{
|
||||||
MaxFileSize: 10 * 1024 * 1024, // 10MB
|
MaxFileSize: 10 * 1024 * 1024, // 10MB
|
||||||
AllowedMimeTypes: map[string]bool{
|
AllowedMimeTypes: map[string]bool{
|
||||||
|
"application/json": true,
|
||||||
|
"application/msword": true,
|
||||||
"application/pdf": true,
|
"application/pdf": true,
|
||||||
|
"application/vnd.ms-excel": true,
|
||||||
|
"application/vnd.ms-powerpoint": true,
|
||||||
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation": true,
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": true,
|
||||||
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": true,
|
||||||
|
"image/jpeg": true,
|
||||||
|
"image/png": true,
|
||||||
|
"image/svg+xml": true,
|
||||||
|
"image/webp": true,
|
||||||
|
"text/csv": true,
|
||||||
|
"text/markdown": true,
|
||||||
},
|
},
|
||||||
AllowedExtensions: map[string][]string{
|
AllowedExtensions: map[string][]string{
|
||||||
|
".csv": {"text/csv"},
|
||||||
|
".doc": {"application/msword"},
|
||||||
|
".docx": {"application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
|
||||||
|
".jpeg": {"image/jpeg"},
|
||||||
|
".jpg": {"image/jpeg"},
|
||||||
|
".json": {"application/json"},
|
||||||
|
".md": {"text/markdown"},
|
||||||
".pdf": {"application/pdf"},
|
".pdf": {"application/pdf"},
|
||||||
|
".png": {"image/png"},
|
||||||
|
".ppt": {"application/vnd.ms-powerpoint"},
|
||||||
|
".pptx": {"application/vnd.openxmlformats-officedocument.presentationml.presentation"},
|
||||||
|
".svg": {"image/svg+xml"},
|
||||||
|
".webp": {"image/webp"},
|
||||||
|
".xls": {"application/vnd.ms-excel"},
|
||||||
|
".xlsx": {"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user