- Introduced unit tests for SQLite facade helpers, including schema validation, query building, and async operations. - Added integration tests for basic SQLite queries and transaction handling. - Implemented additional tests for metadata extraction functions, focusing on dimension handling, EXIF data, and video metadata. - Created tests for security core helpers, covering environment variable checks, IP validation, and CSRF protection. - Included compatibility tests for route exports to ensure proper functionality.
24 lines
636 B
JavaScript
24 lines
636 B
JavaScript
/**
|
|
* Shared path utilities for frontend modules.
|
|
*/
|
|
|
|
export function toPosixPath(value) {
|
|
return String(value || "").replace(/\\/g, "/");
|
|
}
|
|
|
|
export function splitFilenameAndSubfolder(value) {
|
|
const normalized = toPosixPath(value).trim();
|
|
if (!normalized) return { filename: "", subfolder: "" };
|
|
const idx = normalized.lastIndexOf("/");
|
|
if (idx < 0) return { filename: normalized, subfolder: "" };
|
|
return {
|
|
filename: normalized.slice(idx + 1),
|
|
subfolder: normalized.slice(0, idx),
|
|
};
|
|
}
|
|
|
|
export function hasWindowsDrivePrefix(value) {
|
|
return /^[a-zA-Z]:\//.test(String(value || ""));
|
|
}
|
|
|