Summary
In platform-api/src/internal/service/websub_api.go, the mapWebSubAPIModelToAPI function (line 417) dereferences the pointer returned by mapWebSubChannelsModelToAPI, which returns nil when the input channel map is empty. This causes a nil-pointer dereference panic at runtime when a WebSub API has no channels.
Location
- File:
platform-api/src/internal/service/websub_api.go
- Function:
mapWebSubAPIModelToAPI
- Line: 417
Steps to Reproduce
Retrieve a WebSub API that was created or stored with an empty channels map. The Get, List, or Update return path will trigger the panic via mapWebSubAPIModelToAPI.
Expected Behavior
The mapping should handle an empty or nil channel map gracefully and return an empty (non-nil) value for Channels.
Related
Reported by @senthuran16.
Summary
In
platform-api/src/internal/service/websub_api.go, themapWebSubAPIModelToAPIfunction (line 417) dereferences the pointer returned bymapWebSubChannelsModelToAPI, which returnsnilwhen the input channel map is empty. This causes a nil-pointer dereference panic at runtime when a WebSub API has no channels.Location
platform-api/src/internal/service/websub_api.gomapWebSubAPIModelToAPISteps to Reproduce
Retrieve a WebSub API that was created or stored with an empty channels map. The
Get,List, orUpdatereturn path will trigger the panic viamapWebSubAPIModelToAPI.Expected Behavior
The mapping should handle an empty or nil channel map gracefully and return an empty (non-nil) value for
Channels.Related
Reported by @senthuran16.