Problem
In internal/app/update.go, appendActivity truncates device IDs with a direct slice:
entry.Message = ev.DeviceID[:min(8, len(ev.DeviceID))] + " connected"
This is fine for valid Syncthing device IDs (always long), but if ev.DeviceID is ever empty (e.g. a malformed event, or an event type that didn't parse a device ID correctly), ev.DeviceID[:min(8, 0)] evaluates to ev.DeviceID[:0] which returns "" — harmless in that case. However the same pattern in handleGetActivity in mcpserver/server.go is:
out += fmt.Sprintf("● %s connected\n", ev.DeviceID[:min(8, len(ev.DeviceID))])
If DeviceID is empty and an event slips through, this silently emits a blank line. More importantly, both places should use shortID() which already handles this safely, keeping the logic in one place.
Fix
Export shortID (rename to ShortID) from the syncthing package and use it consistently in both update.go and server.go instead of inline slicing.
Problem
In
internal/app/update.go,appendActivitytruncates device IDs with a direct slice:This is fine for valid Syncthing device IDs (always long), but if
ev.DeviceIDis ever empty (e.g. a malformed event, or an event type that didn't parse a device ID correctly),ev.DeviceID[:min(8, 0)]evaluates toev.DeviceID[:0]which returns""— harmless in that case. However the same pattern inhandleGetActivityinmcpserver/server.gois:If
DeviceIDis empty and an event slips through, this silently emits a blank line. More importantly, both places should useshortID()which already handles this safely, keeping the logic in one place.Fix
Export
shortID(rename toShortID) from thesyncthingpackage and use it consistently in bothupdate.goandserver.goinstead of inline slicing.