You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(util): truncateMiddle returns full string when maxLength <= 2 due to slice(-0) #20880
truncateMiddle in packages/util/src/path.ts (and the identical implementation in packages/opencode/src/util/locale.ts) has an edge case bug when maxLength is 1 or 2.
When maxLength <= 2, end = Math.floor((maxLength - 1) / 2) evaluates to 0. The function then calls text.slice(-0), which in JavaScript is equivalent to text.slice(0) — returning the entire string rather than an empty suffix. The output therefore far exceeds maxLength.
Activity
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.