import UserID was not read correctly

This commit is contained in:
2026-02-02 15:04:05 +01:00
parent 45d56674c1
commit d38cfd6973
+3 -8
View File
@@ -7,7 +7,6 @@ import (
"net/http" "net/http"
"os" "os"
"path/filepath" "path/filepath"
"strconv"
"strings" "strings"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
@@ -59,13 +58,9 @@ func UploadFiles(c *gin.Context) {
return return
} }
} }
userIDStr := c.GetString("userID") userID := c.GetUint("userID")
userID, err := strconv.Atoi(userIDStr)
if err != nil { character, err3 := ImportVTTJSON(vttFileName, userID)
respondWithError(c, http.StatusInternalServerError, "Invalid user ID")
return
}
character, err3 := ImportVTTJSON(vttFileName, uint(userID))
if err3 != nil { if err3 != nil {
respondWithError(c, http.StatusInternalServerError, fmt.Sprintf("Failed to Import Character from file %s", err3.Error())) respondWithError(c, http.StatusInternalServerError, fmt.Sprintf("Failed to Import Character from file %s", err3.Error()))
return return