Skip to content

Commit

Permalink
fix: #131 panic syntax error in pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
simulot committed Jan 20, 2024
1 parent 0a7eec3 commit 815ef70
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
17 changes: 17 additions & 0 deletions browser/files/localassets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/fs"
"path"
"path/filepath"
"runtime"
"strings"
"time"

Expand Down Expand Up @@ -180,6 +181,7 @@ func (la *LocalAssetBrowser) checkSidecar(fsys fs.FS, f *browser.LocalAssetFile,
}

func baseNames(n string) []string {
n = escapeName(n)
names := []string{n}
ext := path.Ext(n)
for {
Expand All @@ -196,6 +198,21 @@ func baseNames(n string) []string {
ext = path.Ext(n)
}
}
func escapeName(n string) string {
b := strings.Builder{}
for _, c := range n {
switch c {
case '*', '?', '[', ']', '^':
b.WriteRune('\\')
case '\\':
if runtime.GOOS != "windows" {
b.WriteRune('\\')
}
}
b.WriteRune(c)
}
return b.String()
}

func (la *LocalAssetBrowser) addAlbum(dir string) {
base := path.Base(dir)
Expand Down
7 changes: 7 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release notes

## Release 0.9.12

### fix: #131 panic syntax error in pattern

Some file names trigger a panic when checking the existence of XMP file


## Release 0.9.11

### fix: #130 Support RW2
Expand Down

0 comments on commit 815ef70

Please sign in to comment.