Skip to content

Have json.Unmarshal exception on some commits message #1

@andy-y-li

Description

@andy-y-li

I Have debug it today, found that:
When the jsonStr:
[{"commit": "81effe674dfe5d0bfd242112ffa61051a20580e8","refs": "","subject": "templates/user/profile: added rel="me" to website link on user profile (#5485)","body": "* Added rel="me" to website link on user profile

See issue #5008

  • Added nofollow as per feedback
    ","author": {"name": "Federico Culloca","email": "federicoculloca@users.noreply.github.com","date": "2018-11-13T02:49:30+01:00"},"commiter": {"name": "Unknwon","email": "u@gogs.io","date": "2018-11-12T20:49:30-05:00"}}]

It has an exception on these code:
invalid character 'm' after object key:value pair

var commits []*GitCommit
err = json.Unmarshal([]byte(jsonStr), &commits)
if err != nil {
return nil, err
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions