Fix empty strip preventing create

This commit is contained in:
Owen
2025-12-06 21:37:10 -05:00
parent a812dde026
commit 8cced5011b
2 changed files with 10 additions and 2 deletions

View File

@@ -179,9 +179,13 @@ const addTargetSchema = z
return false; return false;
} }
// If rewritePathType is provided, rewritePath must be provided // If rewritePathType is provided, rewritePath must be provided
// Exception: stripPrefix can have an empty rewritePath (to just strip the prefix)
if (data.rewritePathType && !data.rewritePath) { if (data.rewritePathType && !data.rewritePath) {
// Allow empty rewritePath for stripPrefix type
if (data.rewritePathType !== "stripPrefix") {
return false; return false;
} }
}
return true; return true;
}, },
{ {

View File

@@ -190,9 +190,13 @@ const addTargetSchema = z
return false; return false;
} }
// If rewritePathType is provided, rewritePath must be provided // If rewritePathType is provided, rewritePath must be provided
// Exception: stripPrefix can have an empty rewritePath (to just strip the prefix)
if (data.rewritePathType && !data.rewritePath) { if (data.rewritePathType && !data.rewritePath) {
// Allow empty rewritePath for stripPrefix type
if (data.rewritePathType !== "stripPrefix") {
return false; return false;
} }
}
return true; return true;
}, },
{ {