[geary/gnumdk/stable: 3/21] engine: api: AccountInformation: Do not convert string to human-readable if looks like an ip




commit f34fb81610d3a61a754c313af2d032479bb4764b
Author: Cédric Bellegarde <cedric bellegarde adishatz org>
Date:   Thu Jun 30 22:21:11 2022 +0200

    engine: api: AccountInformation: Do not convert string to human-readable if looks like an ip
    
    Fix #1387

 src/engine/api/geary-account-information.vala | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala
index 242a3561a..9dcd367e5 100644
--- a/src/engine/api/geary-account-information.vala
+++ b/src/engine/api/geary-account-information.vala
@@ -54,7 +54,8 @@ public class Geary.AccountInformation : BaseObject {
                     value = email_domain;
                 } else {
                     string[] host_parts = this.incoming.host.split(".");
-                    if (host_parts.length > 2) {
+                    // If first part is an integer, looks like an ip so ignore it
+                    if (host_parts.length > 2 && int.parse(host_parts[0]) == 0) {
                         host_parts = host_parts[1:host_parts.length];
                     }
                     value = string.joinv(".", host_parts);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]