Merge pull request #841 from PicPeak/chore/storage-ignore-dead-code

chore(backend): ignore runtime storage in git/docker, remove dead getSafeFilename
This commit is contained in:
Paul Nothaft
2026-07-19 11:18:59 +02:00
committed by GitHub
3 changed files with 4 additions and 25 deletions
+3 -2
View File
@@ -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/
+1 -3
View File
@@ -1,9 +1,7 @@
node_modules
npm-debug.log
.env
storage/events/active/*
storage/events/archived/*
storage/thumbnails/*
storage
data/*.db
logs/*
coverage
-20
View File
@@ -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,