This commit is contained in:
@@ -11,9 +11,9 @@ import (
|
||||
func GetCharacterList() []string {
|
||||
charactersPath := os.Getenv("CHARACTERS_PATH")
|
||||
logging.GetLogger().Debug("Getting character list", zap.String("path", charactersPath))
|
||||
if !strings.HasSuffix(charactersPath, "/") {
|
||||
charactersPath += "/"
|
||||
}
|
||||
// Clean the path - remove trailing slashes and then add one for consistency
|
||||
charactersPath = strings.TrimSuffix(charactersPath, "/")
|
||||
charactersPath += "/"
|
||||
files, err := os.ReadDir(charactersPath)
|
||||
if err != nil {
|
||||
logging.GetLogger().Fatal("Failed to read characters directory", zap.String("path", charactersPath), zap.String("error", err.Error()))
|
||||
@@ -31,9 +31,9 @@ func GetCharacterList() []string {
|
||||
func GetCharacter(character string) string {
|
||||
charactersPath := os.Getenv("CHARACTERS_PATH")
|
||||
logging.GetLogger().Debug("Getting character", zap.String("character", character), zap.String("path", charactersPath))
|
||||
if !strings.HasSuffix(charactersPath, "/") {
|
||||
charactersPath += "/"
|
||||
}
|
||||
// Clean the path - remove trailing slashes and then add one for consistency
|
||||
charactersPath = strings.TrimSuffix(charactersPath, "/")
|
||||
charactersPath += "/"
|
||||
return charactersPath + character
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user