From 356ec26c87c2ad18e8bbf9d3006bc6ad5fa1769e Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Sun, 3 Aug 2025 15:48:57 +0200 Subject: [PATCH] fix(gui): fix identicon generation (#10228) ### Purpose Identicon generation is supposed to consider the first 15 characters of a device ID, e.g. if the ID is `ABCDEFG-HIJKLMN-...`, the identicon should be based on `ABCDEFGHIJKLMN`. However, the current implementation only strips the first dash, resulting in `ABCDEFGHIJKLM-`, so the last character is essentially fixed for all IDs. This corresponds to the lower-middle pixel in identicons always being "off" (see screenshots below). The fix is simple: Just add the `g` flag to the regex used to strip dashes. ### Screenshots Old vs. new, light theme: light-old light-new Old vs. new, dark theme: dark-old dark-new Old vs. new, black theme: black-old black-new Only ~50% of identicons will be affected, since it's based on the parity of the 15th character. --- gui/default/syncthing/core/identiconDirective.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/default/syncthing/core/identiconDirective.js b/gui/default/syncthing/core/identiconDirective.js index ff91a9fba..48cc43e27 100644 --- a/gui/default/syncthing/core/identiconDirective.js +++ b/gui/default/syncthing/core/identiconDirective.js @@ -34,7 +34,7 @@ angular.module('syncthing.core') middleCol = Math.ceil(size / 2) - 1; if (value) { - value = value.toString().replace(/[\W_]/i, ''); + value = value.toString().replace(/[\W_]/g, ''); for (row = 0; row < size; ++row) { for (col = middleCol; col > -1; --col) {