Skip to content

Commit

Permalink
check if the file is python or not
Browse files Browse the repository at this point in the history
  • Loading branch information
j03-dev committed Dec 25, 2024
1 parent 6cbfad5 commit 8f9fc5f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/typegate/engine/src/py_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ fn read_file(path: &str) -> Result<String> {

#[deno_core::op2(fast)]
pub fn op_validate(#[string] input: String) -> Result<()> {
let python_source = read_file(&input)?;
ast::Suite::parse(&python_source, "<embedded>")?;
if let Some(file_name) = input.split(".").last() {
if file_name == "py" {
let python_source = read_file(&input)?;
ast::Suite::parse(&python_source, "<embedded>")?;
}
}
Ok(())
}

0 comments on commit 8f9fc5f

Please sign in to comment.