Skip to content

Commit

Permalink
Add zipinsecurepath to rwp (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolatkey authored Sep 12, 2024
1 parent 497974a commit 5285f17
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/rwp/main.go
Original file line number Diff line number Diff line change
@@ -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()
}

0 comments on commit 5285f17

Please sign in to comment.