FIx shared structs + add better debugging/linting (#379)
* fix: Fixes issues w/ shared pointers to structs (#378) * feat: Adds even better debugging and linting support (#376) This is a #PATCH release.
This commit is contained in:
committed by
GitHub
parent
c3d7f26e3c
commit
5c9b88db4f
@@ -64,6 +64,11 @@ func (a emojiService) deleteEmojiFromNote(w http.ResponseWriter, r *http.Request
|
||||
suffix := strings.TrimPrefix(r.URL.Path, "/mr/awardable/note/")
|
||||
ids := strings.Split(suffix, "/")
|
||||
|
||||
if len(ids) < 2 {
|
||||
handleError(w, errors.New("missing IDs"), "Must provide note ID and awardable ID", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
noteId, err := strconv.Atoi(ids[0])
|
||||
if err != nil {
|
||||
handleError(w, err, "Could not convert note ID to integer", http.StatusBadRequest)
|
||||
@@ -158,18 +163,18 @@ func attachEmojis(a *data, fr FileReader) error {
|
||||
reader, err := fr.ReadFile(filePath)
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not find emojis at %s", filePath)
|
||||
return fmt.Errorf("could not find emojis at %s", filePath)
|
||||
}
|
||||
|
||||
bytes, err := io.ReadAll(reader)
|
||||
if err != nil {
|
||||
return errors.New("Could not read emoji file")
|
||||
return errors.New("could not read emoji file")
|
||||
}
|
||||
|
||||
var emojiMap EmojiMap
|
||||
err = json.Unmarshal(bytes, &emojiMap)
|
||||
if err != nil {
|
||||
return errors.New("Could not unmarshal emojis")
|
||||
return errors.New("could not unmarshal emojis")
|
||||
}
|
||||
|
||||
a.emojiMap = emojiMap
|
||||
|
||||
Reference in New Issue
Block a user