Skip to content

Commit

Permalink
Merge pull request #63 from nlnwa/fix-new-record
Browse files Browse the repository at this point in the history
Fix error handling in new record
  • Loading branch information
maeb authored May 3, 2022
2 parents 349b54f + b00844c commit ab189e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/index/record.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ func newRecord(wr gowarc.WarcRecord, filename string, offset int64, length int64
Rle: length,
Rct: wr.WarcHeader().GetId(gowarc.WarcConcurrentTo),
}
if ssu, err := surt.StringToSsurt(wr.WarcHeader().Get(gowarc.WarcTargetURI)); err == nil {
if ssu, err := surt.StringToSsurt(rec.Uri); err != nil {
return rec, fmt.Errorf("failed to convert url '%s' to ssurt: %w", rec.Uri, err)
} else {
rec.Ssu = ssu
}
t, err := wr.WarcHeader().GetTime(gowarc.WarcDate)
Expand Down

0 comments on commit ab189e1

Please sign in to comment.