diff --git a/groupsv2/groupsv2.go b/groupsv2/groupsv2.go index 05500c2..6ab91ae 100644 --- a/groupsv2/groupsv2.go +++ b/groupsv2/groupsv2.go @@ -246,7 +246,7 @@ func HandleGroupsV2(src string, dm *signalservice.DataMessage) (*GroupV2, error) log.Errorln("[textsecure][groupsv2] signature verification failed", err) return nil, err } - log.Debugln("[textsecure][groupsv2] signature verification succesful") + log.Debugln("[textsecure][groupsv2] signature verification successful") } } diff --git a/profiles/profile.go b/profiles/profile.go index a54536a..f626afc 100644 --- a/profiles/profile.go +++ b/profiles/profile.go @@ -140,22 +140,30 @@ type Profile struct { func GetProfile(UUID string, profileKey []byte) (*Profile, error) { resp, err := transport.Transport.Get(fmt.Sprintf(PROFILE_PATH, UUID)) - profile := &Profile{} - + if err != nil { + log.Debugln("[textsecure] GetProfile", err) + return nil, err + } + if resp.IsError() { + log.Debugln("[textsecure] GetProfile", resp) + return nil, resp + } + dec := json.NewDecoder(resp.Body) + profile := &Profile{} err = dec.Decode(&profile) if err != nil { log.Debugln("[textsecure] GetProfile", err) return nil, err - } else { - err = decryptProfile(profileKey, profile) - if err != nil { - log.Debugln("[textsecure] ", err) - return nil, err - } } - return profile, nil + err = decryptProfile(profileKey, profile) + if err != nil { + log.Debugln("[textsecure] GetProfile", err) + return nil, err + } + + return profile, nil } func GetProfileAndCredential(UUID string, profileKey []byte) (*Profile, error) { log.Infoln("[textsecure] GetProfileAndCredential")