Skip to content

Commit d0fabd0

Browse files
committed
fix(store/fscache): trim directory name from path in key extraction
1 parent 798f961 commit d0fabd0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

store/fscache/fscache.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import (
5050
"context"
5151
"crypto/rand"
5252
"io/fs"
53+
"strings"
5354

5455
"errors"
5556
"fmt"
@@ -59,7 +60,6 @@ import (
5960
"os"
6061
"path/filepath"
6162
"slices"
62-
"strings"
6363
"time"
6464

6565
"github.com/bartventer/httpcache/store"
@@ -436,7 +436,9 @@ func (c *fsCache) keys(prefix string) ([]string, error) {
436436
if d.IsDir() {
437437
return nil
438438
}
439-
key, err := c.fnk.KeyFromFileName(filepath.Base(path))
439+
key, err := c.fnk.KeyFromFileName(
440+
strings.TrimPrefix(path, dirname+string(os.PathSeparator)),
441+
)
440442
if err != nil {
441443
return err
442444
}

0 commit comments

Comments
 (0)