From caa98c45fdb72294f6317cf6b5741e7e564e2824 Mon Sep 17 00:00:00 2001 From: Paul <_@u1l.de> Date: Mon, 2 Aug 2021 13:51:43 +0200 Subject: [PATCH] ignore shebang --- internal/model/model.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/model/model.go b/internal/model/model.go index 58ec3e1..1bdd8fd 100644 --- a/internal/model/model.go +++ b/internal/model/model.go @@ -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) }