Skip to content

Commit

Permalink
[backend] disable file upload in draft
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyCloarec committed Oct 1, 2024
1 parent 5d1b7aa commit 6c7890b
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { logApp } from '../config/conf';
import { allFilesForPaths, EXPORT_STORAGE_PATH, IMPORT_STORAGE_PATH, SUPPORT_STORAGE_PATH } from '../modules/internal/document/document-domain';
import { deleteWorkForSource } from '../domain/work';
import { ENTITY_TYPE_SUPPORT_PACKAGE } from '../modules/support/support-types';
import { inDraftContext } from '../utils/draftContext';

interface FileUploadOpts {
entity?:BasicStoreBase | unknown, // entity on which the file is uploaded
Expand Down Expand Up @@ -53,6 +54,7 @@ interface S3File {
* @param opts
*/
export const uploadToStorage = (context: AuthContext, user: AuthUser, filePath: string, fileUpload: FileUploadData, opts: FileUploadOpts) => {
if (inDraftContext(context, user)) throw new Error('Cannot upload file in draft context');
return upload(context, user, filePath, fileUpload, opts);
};

Expand Down

0 comments on commit 6c7890b

Please sign in to comment.