Skip to content

Unable to uncompress zip file #345

@philbinj

Description

@philbinj

The following code panics for my file:

import (
	"fmt"
	"io"
	"log"
	"os"

	"github.com/bodgit/sevenzip"
)

func main() {
	// Open a zip archive for reading.
	r, err := sevenzip.OpenReader("/tmp/scene.zip")
	if err != nil {
		log.Fatal(err)
	}
	defer r.Close()

	for _, f := range r.File {
		fmt.Printf("Contents of %s:\n", f.Name)
		rc, err := f.Open()
		if err != nil {
			log.Fatal(err)
		}
		_, err = io.CopyN(os.Stdout, rc, 68)
		if err != nil {
			log.Fatal(err)
		}
		rc.Close()
		fmt.Println()
	}
}
2025/04/15 01:14:22 sevenzip: error initialising: 1 error occurred:
        * sevenzip: not a valid 7-zip file

7z is able to open it:

7z x /tmp/scene.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedwontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions