bug: archive cmd panics if article.Content is shorter than 32 characters #9
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #1
Description
In
sites/archive/cmd/archive/main.go:116:This will panic with a
runtime error: slice bounds out of rangeifarticle.Contentis less than 32 characters long. The browser cmd atcmd/browser/main.go:50-54handles this correctly with a length check, but the archive cmd doesn't.Fix
Add a length check similar to
cmd/browser/main.go:Starting work on this. Will add a length check before slicing
article.Content[:32]insites/archive/cmd/archive/main.go:116, following the same pattern used incmd/browser/main.go.Work finished. PR: #34
Added length check before slicing
article.Content[:32], using the same safe truncation pattern fromcmd/browser/main.go.