mirror of
https://github.com/maaslalani/slides.git
synced 2026-01-09 14:28:05 -05:00
ignore shebang
This commit is contained in:
@@ -164,9 +164,15 @@ func readFile(path string) (string, error) {
|
||||
}
|
||||
content := string(b)
|
||||
|
||||
|
||||
// Pre-process slides if the file is executable to avoid
|
||||
// unintentional code execution when presenting slides
|
||||
if file.IsExecutable(s) {
|
||||
// Remove shebang if file has one
|
||||
if strings.HasPrefix(content, "#!") {
|
||||
content = strings.Join(strings.SplitN(content, "\n", 2)[1:], "\n")
|
||||
}
|
||||
|
||||
content = process.Pre(content)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user