Skip to content

Commit 5d5ec1c

Browse files
committed
fix(safari): address review comments on #581
1 parent d0dafc2 commit 5d5ec1c

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

browser/safari/profiles.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ func readNamedProfilesFromDB(container string) ([]profileContext, error) {
116116
}
117117
out = append(out, newNamedProfile(externalUUID.String, title.String))
118118
}
119+
if err := rows.Err(); err != nil {
120+
return nil, fmt.Errorf("iterate SafariTabs.db rows: %w", err)
121+
}
119122
return out, nil
120123
}
121124

browser/safari/safari_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,16 @@ func TestResolveSourcePaths(t *testing.T) {
130130
dir := t.TempDir()
131131
mkFile(t, dir, "History.db")
132132

133-
sources := buildSources(profileContext{legacyHome: dir})
133+
sources := buildSources(profileContext{legacyHome: dir, container: deriveContainerRoot(dir)})
134134
resolved := resolveSourcePaths(sources)
135135
assert.Contains(t, resolved, types.History)
136136
assert.Equal(t, filepath.Join(dir, "History.db"), resolved[types.History].absPath)
137137
assert.False(t, resolved[types.History].isDir)
138138
}
139139

140140
func TestResolveSourcePaths_Empty(t *testing.T) {
141-
sources := buildSources(profileContext{legacyHome: t.TempDir()})
141+
dir := t.TempDir()
142+
sources := buildSources(profileContext{legacyHome: dir, container: deriveContainerRoot(dir)})
142143
assert.Empty(t, resolveSourcePaths(sources))
143144
}
144145

browser/safari/source.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ func defaultSources(p profileContext) map[types.Category][]sourcePath {
4141
}
4242
}
4343

44-
// namedSources omits shared categories (Bookmark, Download) — those are attributed to the default profile.
44+
// namedSources omits Bookmark (shared plist with no per-entry profile tag, so attributed to default).
45+
// Download is included because Downloads.plist carries DownloadEntryProfileUUIDStringKey per entry;
46+
// extractDownloads filters by owner UUID so default and named profiles each see their own downloads.
4547
//
4648
// LocalStorage slot for a follow-up PR:
4749
//

0 commit comments

Comments
 (0)