1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-12-26 15:42:27 -05:00

Don't mismatch securities because of pointers

This bug could cause transactions from imports with multiple securities
to end up pointing to the wrong securities.
This commit is contained in:
Aaron Lindsay 2017-09-20 14:22:33 -04:00
parent 93a05576b8
commit ec2a9cbdd8

View File

@ -69,7 +69,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
// Find matching existing securities or create new ones for those
// referenced by the OFX import. Also create a map from placeholder import
// SecurityIds to the actual SecurityIDs
var securitymap = make(map[int64]*Security)
var securitymap = make(map[int64]Security)
for _, ofxsecurity := range itl.Securities {
// save off since ImportGetCreateSecurity overwrites SecurityId on
// ofxsecurity
@ -81,7 +81,7 @@ func ofxImportHelper(r io.Reader, w http.ResponseWriter, user *User, accountid i
log.Print(err)
return
}
securitymap[oldsecurityid] = security
securitymap[oldsecurityid] = *security
}
if account.SecurityId != securitymap[importedAccount.SecurityId].SecurityId {