mirror of
https://github.com/marcogll/TaxHacker_s23.git
synced 2026-01-13 13:25:18 +00:00
feat: safer backups
This commit is contained in:
@@ -32,7 +32,7 @@ export async function getTransactionFileUploadPath(fileUuid: string, filename: s
|
||||
|
||||
export async function fullPathForFile(user: User, file: File) {
|
||||
const userUploadsDirectory = await getUserUploadsDirectory(user)
|
||||
return path.join(userUploadsDirectory, file.path)
|
||||
return path.join(userUploadsDirectory, path.normalize(file.path))
|
||||
}
|
||||
|
||||
function formatFilePath(filename: string, date: Date, format = "{YYYY}/{MM}/{name}{ext}") {
|
||||
@@ -46,7 +46,7 @@ function formatFilePath(filename: string, date: Date, format = "{YYYY}/{MM}/{nam
|
||||
|
||||
export async function fileExists(filePath: string) {
|
||||
try {
|
||||
await access(filePath, constants.F_OK)
|
||||
await access(path.normalize(filePath), constants.F_OK)
|
||||
return true
|
||||
} catch {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user