diff --git a/apps/api/src/api/config_profiles.py b/apps/api/src/api/config_profiles.py index aab19fb..97d8907 100644 --- a/apps/api/src/api/config_profiles.py +++ b/apps/api/src/api/config_profiles.py @@ -78,8 +78,13 @@ class MountItem(BaseModel): @classmethod def validate_files(cls, v: dict) -> dict: for path in v.keys(): - if ".." in path or path.startswith("/") or not path: + if ".." in path or not path: raise ValueError(f"Invalid file path: {path}") + if path.startswith("/"): + raise ValueError( + f"Mount file paths must be relative (got: {path}). " + f"The mount target defines the absolute container path." + ) return v @@ -103,8 +108,13 @@ class ConfigProfileCreate(BaseModel): @classmethod def validate_files(cls, v: dict) -> dict: for path in v.keys(): - if ".." in path or path.startswith("/") or not path: + if ".." in path or not path: raise ValueError(f"Invalid file path: {path}") + if path.startswith("/"): + raise ValueError( + f"File paths must be relative (got: {path}). " + f"Use Mounts for absolute container paths." + ) return v @field_validator("env_vars") diff --git a/apps/web/src/pages/config-profiles.tsx b/apps/web/src/pages/config-profiles.tsx index b40caca..11aedca 100644 --- a/apps/web/src/pages/config-profiles.tsx +++ b/apps/web/src/pages/config-profiles.tsx @@ -343,8 +343,8 @@ export const ConfigProfilesPage = () => {

Environment Variables

- {Object.entries(formData.env_vars || {}).map(([key, value]) => ( -
+ {Object.entries(formData.env_vars || {}).map(([key, value], idx) => ( +
{

Files

- {Object.entries(formData.files || {}).map(([path, content]) => ( -
+

Relative paths written to the instance directory. Use Mounts below for absolute container paths.

+ {Object.entries(formData.files || {}).map(([path, content], idx) => ( +
{

Mounts

+

Bind directories into the container at absolute paths. Files are relative to the mount target.

{(formData.mounts || []).map((mount, index) => (
@@ -442,8 +444,8 @@ export const ConfigProfilesPage = () => {
- {Object.entries(mount.files).map(([path, content]) => ( -
+ {Object.entries(mount.files).map(([path, content], idx) => ( +