diff --git a/cmd/rwp/main.go b/cmd/rwp/main.go index 7e81713f..1c05f845 100644 --- a/cmd/rwp/main.go +++ b/cmd/rwp/main.go @@ -1,7 +1,22 @@ package main -import "github.com/readium/go-toolkit/cmd/rwp/cmd" +import ( + "os" + + "github.com/readium/go-toolkit/cmd/rwp/cmd" +) func main() { + // From the archive/zip docs: + // If any file inside the archive uses a non-local name + // (as defined by [filepath.IsLocal]) or a name containing backslashes + // and the GODEBUG environment variable contains `zipinsecurepath=0`, + // NewReader returns the reader with an [ErrInsecurePath] error. + if os.Getenv("GODEBUG") == "" { + os.Setenv("GODEBUG", "zipinsecurepath=0") + } else { + os.Setenv("GODEBUG", os.Getenv("GODEBUG")+",zipinsecurepath=0") + } + cmd.Execute() }