mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
fix: filename may not exist
This commit is contained in:
committed by
Carlos Valente
parent
af5d6e1aee
commit
13aeeb278d
@@ -19,7 +19,8 @@ export function ensureDirectory(directory: string): void {
|
|||||||
/**
|
/**
|
||||||
* Ensures that a filename ends with .json extension
|
* Ensures that a filename ends with .json extension
|
||||||
*/
|
*/
|
||||||
export function ensureJsonExtension(filename: string): string {
|
export function ensureJsonExtension(filename: string | undefined): string | undefined {
|
||||||
|
if (!filename) return filename;
|
||||||
return filename.endsWith('.json') ? filename : `${filename}.json`;
|
return filename.endsWith('.json') ? filename : `${filename}.json`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user