Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion browser/chromium/chromium.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package chromium
import (
"io/fs"
"log/slog"
"os"
"path/filepath"
"slices"
"strings"
Expand Down Expand Up @@ -136,6 +137,13 @@ func (c *Chromium) userDataTypePaths(profilePath string, items []types.DataType)
// chromiumWalkFunc return a filepath.WalkFunc to find item's path
func chromiumWalkFunc(items []types.DataType, multiItemPaths map[string]map[types.DataType]string) filepath.WalkFunc {
return func(path string, info fs.FileInfo, err error) error {
if err != nil {
if os.IsPermission(err) {
slog.Warn("skipping walk chromium path permission error", "path", path, "err", err)
return nil
}
return err
}
for _, v := range items {
if info.Name() != v.Filename() {
continue
Expand All @@ -156,7 +164,7 @@ func chromiumWalkFunc(items []types.DataType, multiItemPaths map[string]map[type
multiItemPaths[profileFolder] = map[types.DataType]string{v: path}
}
}
return err
return nil
}
}

Expand Down
10 changes: 9 additions & 1 deletion browser/firefox/firefox.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io/fs"
"log/slog"
"os"
"path/filepath"

Expand Down Expand Up @@ -59,6 +60,13 @@ func (f *Firefox) copyItemToLocal() error {

func firefoxWalkFunc(items []types.DataType, multiItemPaths map[string]map[types.DataType]string) fs.WalkDirFunc {
return func(path string, info fs.DirEntry, err error) error {
if err != nil {
if os.IsPermission(err) {
slog.Warn("skipping walk firefox path permission error", "path", path, "err", err)
return nil
}
return err
}
for _, v := range items {
if info.Name() == v.Filename() {
parentBaseDir := fileutil.ParentBaseDir(path)
Expand All @@ -70,7 +78,7 @@ func firefoxWalkFunc(items []types.DataType, multiItemPaths map[string]map[types
}
}

return err
return nil
}
}

Expand Down