Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Fixed text.Fix() attempting both Png+WebP
Browse files Browse the repository at this point in the history
creation when source file is missing resulting in 2 errors.
  • Loading branch information
bengarrett committed Jul 1, 2022
1 parent 1d33e37 commit 26ca94d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/text/internal/tf/tf.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var (
ErrMeNo = errors.New("no readme chosen")
ErrMeUnk = errors.New("unknown readme")
ErrMeNF = errors.New("readme not found in archive")
ErrPNG = errors.New("no such png file")
)

const (
Expand Down Expand Up @@ -154,7 +155,7 @@ func (t *TextFile) TextPng(c int, dir string) error {
name := filepath.Join(dir, t.UUID)
if _, err := os.Stat(name); os.IsNotExist(err) {
logs.Printf("%s\n", str.X())
return nil
return fmt.Errorf("txtpng: %w", ErrPNG)
} else if err != nil {
return fmt.Errorf("txtpng: %w", err)
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/text/text.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ func Fix() error {
i, c := 0, 0
for rows.Next() {
if i, c, err = fixRow(i, c, &dir, rows); err != nil {
return err
if !errors.Is(err, tf.ErrPNG) {
return err
}
}
}
logs.Println("scanned", c, "fixes from", i, "text file records")
Expand Down

0 comments on commit 26ca94d

Please sign in to comment.