From a678a5d67bf26281f53fc85e6359d88ef14a21c1 Mon Sep 17 00:00:00 2001 From: Xavier Henner Date: Sun, 24 May 2015 21:19:15 +0200 Subject: [PATCH] Fix a bug in Sum() and add all id3frames in Raw() The Seek in SumID3v2() didn't take into account the size of the ID3v2 Header (10 bytes). Thus when tagging the same file with or without it's tag, there was a discrepancy. ( And I've added a default case when parsing the id3v2 tags, by storing the binary content to Raw() --- id3v2.go | 2 ++ sum.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/id3v2.go b/id3v2.go index dda6135..d723a21 100644 --- a/id3v2.go +++ b/id3v2.go @@ -266,6 +266,8 @@ func readID3v2Frames(r io.Reader, h *ID3v2Header) (map[string]interface{}, error return nil, err } result[rawName] = p + default: + result[rawName] = b } continue diff --git a/sum.go b/sum.go index ed9ed95..421c4ef 100644 --- a/sum.go +++ b/sum.go @@ -141,7 +141,7 @@ func SumID3v2(r io.ReadSeeker) (string, error) { return "", fmt.Errorf("error reading ID3v2 header: %v", err) } - _, err = r.Seek(int64(h.Size), os.SEEK_SET) + _, err = r.Seek(int64(h.Size)+10, os.SEEK_SET) if err != nil { return "", fmt.Errorf("error seeking to end of ID3V2 header: %v", err) }