mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-18 21:55:08 +00:00
Fix panic in posts limit usage (#66)
* call model with limits in post * fix bug in posts handler
This commit is contained in:
@@ -210,7 +210,7 @@ func (p *Posts) Index(ctx context.Context, req *proto.IndexRequest, rsp *proto.I
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iterate and add
|
// iterate and add
|
||||||
for i := 0; i <= limit; i++ {
|
for i := 0; i < limit; i++ {
|
||||||
// strip the content
|
// strip the content
|
||||||
posts[i].Content = ""
|
posts[i].Content = ""
|
||||||
rsp.Posts = append(rsp.Posts, posts[i])
|
rsp.Posts = append(rsp.Posts, posts[i])
|
||||||
@@ -256,7 +256,7 @@ func (p *Posts) Query(ctx context.Context, req *proto.QueryRequest, rsp *proto.Q
|
|||||||
}
|
}
|
||||||
|
|
||||||
// iterate and add
|
// iterate and add
|
||||||
for i := 0; i <= limit; i++ {
|
for i := 0; i < limit; i++ {
|
||||||
rsp.Posts = append(rsp.Posts, posts[i])
|
rsp.Posts = append(rsp.Posts, posts[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user