mirror of
https://github.com/napnap75/multiarch-docker-images.git
synced 2026-11-15 18:31:47 +01:00
* Add tools page with find-lost-files consistency tool (US-40, US-41) Co-authored-by: napnap75 <napnap75@users.noreply.github.com> * tools page: hide the job panel when there is nothing to show, guard against undefined rendering Co-authored-by: napnap75 <napnap75@users.noreply.github.com> * inbox: leave non-PDF objects in place, never imported (US-12) Co-authored-by: napnap75 <napnap75@users.noreply.github.com> --------- Co-authored-by: Vibe Nuage Agent <vibe@mistral.ai> Co-authored-by: napnap75 <napnap75@users.noreply.github.com>
25 lines
673 B
Go
25 lines
673 B
Go
package pipeline
|
|
|
|
import "testing"
|
|
|
|
// TestIsPDF covers the inbox rule: only content carrying the %PDF- header
|
|
// enters the pipeline; anything else is left in place (US-12).
|
|
func TestIsPDF(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
data []byte
|
|
want bool
|
|
}{
|
|
{"pdf header", []byte("%PDF-1.7\n..."), true},
|
|
{"pdf header with leading whitespace", []byte("\n%PDF-1.4"), false},
|
|
{"plain text", []byte("not a pdf at all\n"), false},
|
|
{"image content", []byte("\x89PNG\r\n\x1a\n..."), false},
|
|
{"empty", nil, false},
|
|
}
|
|
for _, c := range cases {
|
|
if got := isPDF(c.data); got != c.want {
|
|
t.Errorf("%s: isPDF = %v, want %v", c.name, got, c.want)
|
|
}
|
|
}
|
|
}
|