fix: block uploading already existing file name

This commit is contained in:
arc-alex
2025-12-11 15:35:41 +01:00
committed by Carlos Valente
parent f0e81c0cf0
commit 77225383a4
3 changed files with 27 additions and 7 deletions
@@ -9,18 +9,25 @@ import { dockerSafeRename, getFilesFromFolder, removeFileExtension } from '../..
/**
* Handles the upload of a new project file
* @throws if the file already exits
* @param filePath
* @param name
*/
export async function handleUploaded(filePath: string, name: string) {
export async function handleProjectUploaded(filePath: string, name: string) {
const newFilePath = join(publicDir.projectsDir, name);
await dockerSafeRename(filePath, newFilePath);
}
/**
* Handles the upload of a logo image
* @throws if the file already exits
* @param filePath
* @param name
* @returns
*/
export async function handleImageUpload(filePath: string, name: string): Promise<string> {
const newFilePath = join(publicDir.logoDir, name);
await dockerSafeRename(filePath, newFilePath);
return name;
}