fix: Use list append instead of indexing
This commit is contained in:
parent
a1df02b41c
commit
175770d8b8
1 changed files with 8 additions and 7 deletions
|
@ -119,14 +119,15 @@ func (p *Postback) Push(m messenger.Message) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.Attachments) > 0 {
|
if len(m.Attachments) > 0 {
|
||||||
a := make([]attachment, 0, len(m.Attachments))
|
files := make([]attachment, 0, len(m.Attachments))
|
||||||
for i := 0; i < len(m.Attachments); i++ {
|
for _, f := range m.Attachments {
|
||||||
a[i] = attachment{
|
a := attachment{
|
||||||
Name: m.Attachments[i].Name,
|
Name: f.Name,
|
||||||
Header: m.Attachments[i].Header,
|
Header: f.Header,
|
||||||
Content: make([]byte, len(m.Attachments[i].Content)),
|
Content: make([]byte, len(f.Content)),
|
||||||
}
|
}
|
||||||
copy(a[i].Content, m.Attachments[i].Content)
|
copy(a.Content, f.Content)
|
||||||
|
files = append(files, a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue