diff --git a/.gitignore b/.gitignore index 956c3b23..d066ec46 100644 --- a/.gitignore +++ b/.gitignore @@ -130,5 +130,6 @@ docker-compose.dev.yml # New layout development files new-layouts/ -# Generated CRM/accounting documents (runtime) — never commit -backend/storage/business-docs/ +# Backend runtime storage (generated media, previews, thumbnails, +# CRM/accounting documents) — never commit +backend/storage/ diff --git a/backend/.dockerignore b/backend/.dockerignore index e4d1265f..ef5a7a92 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1,9 +1,7 @@ node_modules npm-debug.log .env -storage/events/active/* -storage/events/archived/* -storage/thumbnails/* +storage data/*.db logs/* coverage diff --git a/backend/src/utils/fileSecurityUtils.js b/backend/src/utils/fileSecurityUtils.js index 5eec0f0f..05dbb194 100644 --- a/backend/src/utils/fileSecurityUtils.js +++ b/backend/src/utils/fileSecurityUtils.js @@ -213,25 +213,6 @@ async function validateFileContent(filePath, expectedMimeType) { } } -/** - * Get safe filename for storage - * @param {string} originalFilename - Original filename - * @returns {string} - Safe filename - */ -function getSafeFilename(originalFilename) { - const timestamp = Date.now(); - const randomString = Math.random().toString(36).substring(2, 15); - const ext = path.extname(originalFilename).toLowerCase(); - - // Validate extension - including both image and video extensions - const validExtensions = ['.jpg', '.jpeg', '.png', '.webp', '.gif', '.svg', '.ico', '.mp4', '.m4v', '.webm', '.mov', '.avi']; - if (!validExtensions.includes(ext)) { - throw new Error('Invalid file extension'); - } - - return `upload_${timestamp}_${randomString}${ext}`; -} - /** * Create a file upload validator middleware * @param {Object} options - Validation options @@ -295,7 +276,6 @@ module.exports = { isPathSafe, validateFileType, validateFileContent, - getSafeFilename, createFileUploadValidator, ALLOWED_IMAGE_TYPES, ALLOWED_VIDEO_TYPES,