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,8 +179,12 @@ const addTargetSchema = z
return false;
}
// 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) {
return false;
// Allow empty rewritePath for stripPrefix type
if (data.rewritePathType !== "stripPrefix") {
return false;
}
}
return true;
},

View File

@@ -190,8 +190,12 @@ const addTargetSchema = z
return false;
}
// 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) {
return false;
// Allow empty rewritePath for stripPrefix type
if (data.rewritePathType !== "stripPrefix") {
return false;
}
}
return true;
},