aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Badida <KeyWeeUsr@users.noreply.github.com>2024-01-02 17:31:57 +0100
committerGitHub <noreply@github.com>2024-01-02 17:31:57 +0100
commit2abfefc18cb3020b68a113d7099950e98709b22b (patch)
treeef551591620295fe92f87a537c7811af2a3b8b4a /lib
parent86a08eb87df2aa6cf1ab631120a0b918617a98b3 (diff)
downloadsyncthing-2abfefc18cb3020b68a113d7099950e98709b22b.tar.gz
syncthing-2abfefc18cb3020b68a113d7099950e98709b22b.zip
gui: Keep short deviceID length consistent + xrefs (fixes #9313) (#9314)
Making short deviceID length consistent and referencing to protocol file for future-proof edits. Closes #9313.
Diffstat (limited to 'lib')
-rw-r--r--lib/protocol/deviceid.go3
-rw-r--r--lib/protocol/deviceid_test.go1
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/protocol/deviceid.go b/lib/protocol/deviceid.go
index fee2f6d65..25ecbc1a3 100644
--- a/lib/protocol/deviceid.go
+++ b/lib/protocol/deviceid.go
@@ -14,7 +14,8 @@ import (
)
const (
- DeviceIDLength = 32
+ DeviceIDLength = 32
+ // keep consistent with shortIDStringLength in gui/default/syncthing/app.js
ShortIDStringLength = 7
)
diff --git a/lib/protocol/deviceid_test.go b/lib/protocol/deviceid_test.go
index 90fa3e000..00d09e4a3 100644
--- a/lib/protocol/deviceid_test.go
+++ b/lib/protocol/deviceid_test.go
@@ -84,6 +84,7 @@ func TestShortIDString(t *testing.T) {
id, _ := DeviceIDFromString(formatted)
sid := id.Short().String()
+ // keep consistent with ShortIDStringLength in lib/protocol/deviceid.go
if len(sid) != 7 {
t.Errorf("Wrong length for short ID: got %d, want 7", len(sid))
}