-
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Title: Issue with archives.Identify
when filename contains a compression extension
Description:
I encountered an issue while using the archives.Identify
function from the github.com/mholt/archives
package. When the file name includes a compression extension (e.g., test.gzero.zip
), the function returns an error: gzip: invalid header
.
Here is the code snippet to reproduce the issue:
package main
import (
"context"
"fmt"
"os"
"github.com/mholt/archives"
)
func main() {
var err error
ctx := context.Background()
stream, _ := os.Open("testzip") // zip stream
defer stream.Close()
_, _, err = archives.Identify(ctx, "test.gzero.zip", stream) // filename contains Compression extension
fmt.Println(err) // matching zip: gzip: invalid header
_, _, err = archives.Identify(ctx, "test.zip", stream)
fmt.Println(err) // nil
}
Steps to Reproduce:
- Open a zip file stream using
os.Open
. - Pass the filename with a compression extension (e.g.,
test.gzero.zip
) toarchives.Identify
. - Observe that the function returns an error (
gzip: invalid header
).
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed