Skip to content

Commit

Permalink
Make the extension comparison to strict
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Apr 8, 2024
1 parent 699b325 commit 4d2e93b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lz4.go
Expand Up @@ -3,6 +3,7 @@ package archiver
import (
"bytes"
"io"
"path/filepath"
"strings"

"github.com/pierrec/lz4/v4"
Expand All @@ -23,7 +24,7 @@ func (lz Lz4) Match(filename string, stream io.Reader) (MatchResult, error) {
var mr MatchResult

// match filename
if strings.Contains(strings.ToLower(filename), lz.Name()) {
if filepath.Ext(strings.ToLower(filename)) == lz.Name() {
mr.ByName = true
}

Expand Down
3 changes: 2 additions & 1 deletion lzip.go
Expand Up @@ -3,6 +3,7 @@ package archiver
import (
"bytes"
"io"
"path/filepath"
"strings"

"github.com/sorairolake/lzip-go"
Expand All @@ -21,7 +22,7 @@ func (lz Lzip) Match(filename string, stream io.Reader) (MatchResult, error) {
var mr MatchResult

// match filename
if strings.Contains(strings.ToLower(filename), lz.Name()) {
if filepath.Ext(strings.ToLower(filename)) == lz.Name() {
mr.ByName = true
}

Expand Down

0 comments on commit 4d2e93b

Please sign in to comment.