From b285b07986e438149c8d2287459b580d2280214c Mon Sep 17 00:00:00 2001 From: hkfires <10558748+hkfires@users.noreply.github.com> Date: Wed, 19 Nov 2025 19:50:06 +0800 Subject: [PATCH] fix(iflow): adjust auth filename email sanitization --- internal/cmd/iflow_cookie.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/cmd/iflow_cookie.go b/internal/cmd/iflow_cookie.go index ed9c0481..9d99a5bd 100644 --- a/internal/cmd/iflow_cookie.go +++ b/internal/cmd/iflow_cookie.go @@ -95,14 +95,13 @@ func promptForCookie(promptFn func(string) (string, error)) (string, error) { // getAuthFilePath returns the auth file path for the given provider and email func getAuthFilePath(cfg *config.Config, provider, email string) string { // Clean email to make it filename-safe - cleanEmail := strings.ReplaceAll(email, "@", "_at_") - cleanEmail = strings.ReplaceAll(cleanEmail, ".", "_") - cleanEmail = strings.ReplaceAll(cleanEmail, "-", "_") + cleanEmail := strings.ReplaceAll(email, "*", "x") - // Remove any remaining special characters + // Remove any unsafe characters, but allow standard email chars (@, ., -) var result strings.Builder for _, r := range cleanEmail { - if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || r == '_' { + if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9') || + r == '_' || r == '@' || r == '.' || r == '-' { result.WriteRune(r) } }