diff --git a/frontend/src/components/ACLRuleBuilder.js b/frontend/src/components/ACLRuleBuilder.js index f186b71..a579ae7 100644 --- a/frontend/src/components/ACLRuleBuilder.js +++ b/frontend/src/components/ACLRuleBuilder.js @@ -348,7 +348,15 @@ function ACLDefinitionCard({ rule, index, onChange, onDelete }) { - {rule.matchType === 'ssl_fc' ? ( - (no value needed) - ) : rule.matchType === 'custom' ? ( - onChange(index, { ...rule, value: e.target.value })} - placeholder="Custom expression..." - size="small" - /> - ) : ( - onChange(index, { ...rule, value: e.target.value })} - placeholder={(rule.flags || []).includes('-f') ? '/path/to/patterns.txt' : (matchDef?.placeholder || 'Value')} - size="small" - /> - )} + {(() => { + const hasFileFlag = (rule.flags || []).includes('-f'); + const badFilePath = hasFileFlag && rule.value && !rule.value.startsWith('/'); + if (rule.matchType === 'ssl_fc') { + return (no value needed); + } + if (rule.matchType === 'custom') { + return ( + onChange(index, { ...rule, value: e.target.value })} + placeholder="Custom expression..." + size="small" + /> + ); + } + return ( + + onChange(index, { ...rule, value: e.target.value })} + placeholder={hasFileFlag ? '/path/to/patterns.txt' : (matchDef?.placeholder || 'Value')} + size="small" + status={badFilePath ? 'error' : undefined} + /> + + ); + })()} @@ -532,12 +551,25 @@ function RedirectRuleCard({ rule, index, onChange, onDelete }) { - onChange(index, { ...rule, target: e.target.value })} - placeholder={rule.type === 'scheme' ? 'https' : 'https://example.com'} - size="small" - /> + {rule.type === 'scheme' ? ( + + ) : ( + onChange(index, { ...rule, target: e.target.value })} + placeholder="https://example.com" + size="small" + /> + )}