mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 06:42:03 +00:00
feat: implement upsert project functionality in sidebar and welcome view
- Refactored project handling in Sidebar and WelcomeView components to use a new `upsertAndSetCurrentProject` action for creating or updating projects. - Enhanced theme preservation logic during project creation and updates by integrating theme management directly into the store action. - Cleaned up redundant code related to project existence checks and state updates, improving maintainability and readability.
This commit is contained in:
@@ -55,6 +55,16 @@ export function createTemplatesRoutes(): Router {
|
||||
// Build full project path
|
||||
const projectPath = path.join(parentDir, sanitizedName);
|
||||
|
||||
const resolvedParent = path.resolve(parentDir);
|
||||
const resolvedProject = path.resolve(projectPath);
|
||||
const relativePath = path.relative(resolvedParent, resolvedProject);
|
||||
if (relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: "Invalid project name; potential path traversal attempt.",
|
||||
});
|
||||
}
|
||||
|
||||
// Check if directory already exists
|
||||
try {
|
||||
await fs.access(projectPath);
|
||||
|
||||
Reference in New Issue
Block a user