Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: fix id converter
Steven480c53d7a2f0
diff --git a/api/v2/resource_name.go b/api/v2/resource_name.goindex 21e903cbc..a12231f58 100644--- a/api/v2/resource_name.go+++ b/api/v2/resource_name.go@@ -2,10 +2,11 @@ package v2import ("fmt"- "strconv""strings""github.com/pkg/errors"++ "github.com/usememos/memos/internal/util")const (@@ -38,9 +39,9 @@ func GetInboxID(name string) (int32, error) {if err != nil {return 0, err}- id, err := strconv.Atoi(tokens[0])+ id, err := util.ConvertStringToInt32(tokens[0])if err != nil {return 0, errors.Errorf("invalid inbox ID %q", tokens[0])}- return int32(id), nil+ return id, nil}diff --git a/internal/util/util.go b/internal/util/util.goindex 96d2fde82..002789d64 100644--- a/internal/util/util.go+++ b/internal/util/util.go@@ -12,11 +12,11 @@ import (// ConvertStringToInt32 converts a string to int32.func ConvertStringToInt32(src string) (int32, error) {- i, err := strconv.Atoi(src)+ parsed, err := strconv.ParseInt(src, 10, 32)if err != nil {return 0, err}- return int32(i), nil+ return int32(parsed), nil}// HasPrefixes returns true if the string s has any of the given prefixes.