mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-22 11:46:40 +00:00
[chore] Fix a few possible cases of int truncation (#1207)
This fixes a couple of cases where due to int being platform dependent a value could get truncated if running on 32bits.
This commit is contained in:
parent
bc917a4085
commit
847e7c7c3a
|
@ -152,7 +152,7 @@ func (m *Module) AccountStatusesGETHandler(c *gin.Context) {
|
||||||
limit := 30
|
limit := 30
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -146,7 +146,7 @@ func (m *Module) EmojisGETHandler(c *gin.Context) {
|
||||||
limit := 50
|
limit := 50
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (m *Module) BlocksGETHandler(c *gin.Context) {
|
||||||
limit := 20
|
limit := 20
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -102,7 +102,7 @@ func (m *Module) FavouritesGETHandler(c *gin.Context) {
|
||||||
limit := 20
|
limit := 20
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -123,7 +123,7 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) {
|
||||||
limit := 20
|
limit := 20
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -109,7 +109,7 @@ func (m *Module) SearchGETHandler(c *gin.Context) {
|
||||||
limit := 2
|
limit := 2
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
@ -127,7 +127,7 @@ func (m *Module) SearchGETHandler(c *gin.Context) {
|
||||||
offset := 0
|
offset := 0
|
||||||
offsetString := c.Query(OffsetKey)
|
offsetString := c.Query(OffsetKey)
|
||||||
if offsetString != "" {
|
if offsetString != "" {
|
||||||
i, err := strconv.ParseInt(offsetString, 10, 64)
|
i, err := strconv.ParseInt(offsetString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", OffsetKey, err)
|
err := fmt.Errorf("error parsing %s: %s", OffsetKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -142,7 +142,7 @@ func (m *Module) HomeTimelineGETHandler(c *gin.Context) {
|
||||||
limit := 20
|
limit := 20
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -153,7 +153,7 @@ func (m *Module) PublicTimelineGETHandler(c *gin.Context) {
|
||||||
limit := 20
|
limit := 20
|
||||||
limitString := c.Query(LimitKey)
|
limitString := c.Query(LimitKey)
|
||||||
if limitString != "" {
|
if limitString != "" {
|
||||||
i, err := strconv.ParseInt(limitString, 10, 64)
|
i, err := strconv.ParseInt(limitString, 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
err := fmt.Errorf("error parsing %s: %s", LimitKey, err)
|
||||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||||
|
|
|
@ -83,7 +83,7 @@ func NewTestDB() db.DB {
|
||||||
}
|
}
|
||||||
|
|
||||||
if alternateDBPort := os.Getenv("GTS_DB_PORT"); alternateDBPort != "" {
|
if alternateDBPort := os.Getenv("GTS_DB_PORT"); alternateDBPort != "" {
|
||||||
port, err := strconv.ParseInt(alternateDBPort, 10, 64)
|
port, err := strconv.ParseUint(alternateDBPort, 10, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue