fix: align sandbox name validation with NemoClaw (#51)

Co-authored-by: mmckeen-nv <mmckeen-nv@users.noreply.github.com>
This commit is contained in:
mmckeen-nv
2026-09-19 23:09:39 -07:00
committed by GitHub
co-authored by mmckeen-nv
parent f70c10d767
commit 52fe7a2d83
5 changed files with 22 additions and 7 deletions
+6 -2
View File
@@ -51,7 +51,8 @@ function contentDispositionFileName(value: string | null, fallback: string) {
function defaultCloneName(source?: SandboxInventoryItem) {
if (!source) return ""
return `${source.name.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "")}-clone`.slice(0, 63)
const base = source.name.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "").slice(0, 13).replace(/-+$/g, "")
return `${base || "sandbox"}-clone`
}
export default function WizardPanel({
@@ -134,7 +135,7 @@ export default function WizardPanel({
const canContinue = (() => {
if (activeStep === "source") return Boolean(sourceSandbox)
if (activeStep === "target") return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(targetName) && targetName.length <= 63
if (activeStep === "target") return /^(?!.*--)[a-z]([a-z0-9-]*[a-z0-9])?$/.test(targetName) && targetName.length <= 19
if (activeStep === "options") return Boolean(backupPath.trim() && restorePath.trim())
if (activeStep === "review") return Boolean(sourceSandbox && targetName.trim())
return false
@@ -626,9 +627,12 @@ export default function WizardPanel({
<input
value={targetName}
onChange={(event) => setTargetName(event.target.value)}
maxLength={19}
pattern="(?!.*--)[a-z](?:[a-z0-9-]*[a-z0-9])?"
placeholder="source-clone"
className="w-full rounded-sm border border-[var(--border-subtle)] bg-[var(--background-tertiary)] px-3 py-2 text-xs font-mono text-[var(--foreground)] focus:outline-none focus:border-[var(--nvidia-green)]"
/>
<span className="text-[11px] text-[var(--foreground-dim)]">1-19 characters; start with a lowercase letter; no consecutive hyphens.</span>
</label>
{activeBlueprint?.supportsTailscale && (
<label className="flex items-center gap-3 text-sm font-mono text-[var(--foreground)]">