From: PhiTux Date: Tue, 9 Sep 2025 13:50:17 +0000 (+0200) Subject: bugfixes X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=0108a3711c0de200c51125ef21c29e2aee9077e2;p=DailyTxT.git bugfixes --- diff --git a/backend/handlers/additional.go b/backend/handlers/additional.go index 8c71642..9d50c12 100644 --- a/backend/handlers/additional.go +++ b/backend/handlers/additional.go @@ -1342,7 +1342,7 @@ func Search(w http.ResponseWriter, r *http.Request) { // Traverse all years and months yearEntries, err := os.ReadDir(userDir) if err != nil { - http.Error(w, fmt.Sprintf("Error reading user directory: %v", err), http.StatusInternalServerError) + http.Error(w, "No logs found to be searched", http.StatusNotFound) return } diff --git a/backend/handlers/users.go b/backend/handlers/users.go index 09bf0fc..47b85bb 100644 --- a/backend/handlers/users.go +++ b/backend/handlers/users.go @@ -279,7 +279,7 @@ func Register(username string, password string) (bool, error) { if username_from_file, ok := user["username"].(string); ok && strings.EqualFold(username_from_file, username) { utils.Logger.Printf("Registration failed. Username '%s' already exists", username) - return false, fmt.Errorf("username already exists: %d", http.StatusBadRequest) + return false, fmt.Errorf("username already exists (error %d)", http.StatusBadRequest) } } } diff --git a/backend/utils/file_handling.go b/backend/utils/file_handling.go index 39dc79c..2f26504 100644 --- a/backend/utils/file_handling.go +++ b/backend/utils/file_handling.go @@ -145,7 +145,6 @@ func GetTags(userID int) (map[string]any, error) { file, err := os.Open(filePath) if err != nil { if os.IsNotExist(err) { - Logger.Printf("%s - File not found", filePath) return map[string]any{}, nil } Logger.Printf("Error opening %s: %v", filePath, err) @@ -212,7 +211,6 @@ func GetUserSettings(userID int) (string, error) { file, err := os.Open(filePath) if err != nil { if os.IsNotExist(err) { - Logger.Printf("%s - File not found", filePath) return "", nil } Logger.Printf("Error opening %s: %v", filePath, err) diff --git a/frontend/src/lib/Sidenav.svelte b/frontend/src/lib/Sidenav.svelte index 76c17ee..2ae549b 100644 --- a/frontend/src/lib/Sidenav.svelte +++ b/frontend/src/lib/Sidenav.svelte @@ -89,7 +89,7 @@ }) .catch((error) => { $searchResults = []; - console.error(error); + console.error(error.response.data); $isSearching = false; // toast diff --git a/frontend/src/routes/login/+page.svelte b/frontend/src/routes/login/+page.svelte index a2ba50e..deffe9e 100644 --- a/frontend/src/routes/login/+page.svelte +++ b/frontend/src/routes/login/+page.svelte @@ -457,13 +457,12 @@ {#if !registration_allowed} {/if} {#if show_registration_failed_with_message}