Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic due to undefined attachment name in ICS205 Radio Plan #470

Open
martinhpedersen opened this issue Jan 21, 2025 · 1 comment
Open
Assignees
Milestone

Comments

@martinhpedersen
Copy link
Member

Hello,

I'm a new user to Pat and could use some assistance.

OS: Ubuntu 24.04.1 LTS
Pat version: Pat v0.16.0 (823b991) linux/amd64 - go1.22.2

I am unable to send ICS205 form, below is my approach and the errors returned:

Template > ICS USA Forms > ICS205 Radio Plan

When clicking "submit", then "ok", a browser window launches to the URL below with error "The connection was reset"

http://localhost:8080/api/form?template=ICS+USA+Forms%2FICS205+Radio+Plan.txt

In the Pat shell, the following messages are generated:

2025/01/21 12:50:02 http: panic serving 127.0.0.1:50330: Empty filename is not allowed
goroutine 89 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0x8f3060?, 0xbfbc50?})
/usr/local/go/src/runtime/panic.go:770 +0x132
github.com/la5nta/wl2k-go/fbb.NewFile(...)
/go/pkg/mod/github.com/la5nta/[email protected]/fbb/message.go:538
github.com/la5nta/pat/internal/forms.messageBuilder.buildAttachments({0x0, 0x0, {{0xc0001c8037, 0x11}, {0xc0001c8000, 0x4c}, {0xc0001c7920, 0x55}, {0xc0001c79e0, 0x54}, ...}, ...})
/src/internal/forms/builder.go:152 +0x5c5
github.com/la5nta/pat/internal/forms.messageBuilder.build({0x0, 0x0, {{0xc0001c8037, 0x11}, {0xc0001c8000, 0x4c}, {0xc0001c7920, 0x55}, {0xc0001c79e0, 0x54}, ...}, ...})
/src/internal/forms/builder.go:47 +0x198
github.com/la5nta/pat/internal/forms.(*Manager).PostFormDataHandler(0xc000141200, {0xc02b28, 0xc0002b0620}, 0xc00056f440)
/src/internal/forms/forms.go:162 +0x858
net/http.HandlerFunc.ServeHTTP(0xc00056f320?, {0xc02b28?, 0xc0002b0620?}, 0x1?)
/usr/local/go/src/net/http/server.go:2166 +0x29
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001560c0, {0xc02b28, 0xc0002b0620}, 0xc00056f200)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1e2
net/http.serverHandler.ServeHTTP({0xc00ed0?}, {0xc02b28?, 0xc0002b0620?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc0001da090, {0xc03128, 0xc00042e360})
/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 28
/usr/local/go/src/net/http/server.go:3285 +0x4b4
2025/01/21 12:50:02 http: panic serving 127.0.0.1:35946: Empty filename is not allowed
goroutine 103 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0x8f3060?, 0xbfbc50?})
/usr/local/go/src/runtime/panic.go:770 +0x132
github.com/la5nta/wl2k-go/fbb.NewFile(...)
/go/pkg/mod/github.com/la5nta/[email protected]/fbb/message.go:538
github.com/la5nta/pat/internal/forms.messageBuilder.buildAttachments({0x0, 0x0, {{0xc00046fcf7, 0x11}, {0xc00046fcc0, 0x4c}, {0xc0001c7b60, 0x55}, {0xc0001c7c20, 0x54}, ...}, ...})
/src/internal/forms/builder.go:152 +0x5c5
github.com/la5nta/pat/internal/forms.messageBuilder.build({0x0, 0x0, {{0xc00046fcf7, 0x11}, {0xc00046fcc0, 0x4c}, {0xc0001c7b60, 0x55}, {0xc0001c7c20, 0x54}, ...}, ...})
/src/internal/forms/builder.go:47 +0x198
github.com/la5nta/pat/internal/forms.(*Manager).PostFormDataHandler(0xc000141200, {0xc02b28, 0xc0002b0000}, 0xc00056e5a0)
/src/internal/forms/forms.go:162 +0x858
net/http.HandlerFunc.ServeHTTP(0xc00056e480?, {0xc02b28?, 0xc0002b0000?}, 0x1?)
/usr/local/go/src/net/http/server.go:2166 +0x29
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0001560c0, {0xc02b28, 0xc0002b0000}, 0xc00056e000)
/go/pkg/mod/github.com/gorilla/[email protected]/mux.go:210 +0x1e2
net/http.serverHandler.ServeHTTP({0xc00ed0?}, {0xc02b28?, 0xc0002b0000?}, 0x6?)
/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc0001da360, {0xc03128, 0xc00042e360})
/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 28
/usr/local/go/src/net/http/server.go:3285 +0x4b4

Any advice is greatly appreciated.

73,
Mike - KC2NJ

@martinhpedersen
Copy link
Member Author

The problem is that the form in question sets attached_text and attached_file even when no attachment should be added. They are both set to empty strings, which we don't handle very well.

The solution is to ignore empty attached_text form values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant