validation: include script path in ScriptFlaggedIllegalKeyword

This commit is contained in:
Quaternions 2025-03-26 16:23:44 -07:00
parent 188fbd2a6d
commit d3edb6b3da
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131

@ -31,7 +31,7 @@ fn hash_source(source:&str)->String{
#[allow(dead_code)]
#[derive(Debug)]
pub enum ValidateError{
ScriptFlaggedIllegalKeyword,
ScriptFlaggedIllegalKeyword(String),
ScriptBlocked(Option<submissions_api::types::ScriptID>),
ScriptNotYetReviewed(Option<submissions_api::types::ScriptID>),
ModelFileDownload(rbx_asset::cookie::GetError),
@ -115,7 +115,9 @@ impl Validator{
// check the source for illegal keywords
if source_has_illegal_keywords(source){
// immediately abort
return Err(ValidateError::ScriptFlaggedIllegalKeyword);
// grab path to offending script
let path=get_partial_path(&dom,script);
return Err(ValidateError::ScriptFlaggedIllegalKeyword(path));
}
// associate a name and policy with the source code
// policy will be fetched from the database to replace the default policy