File tree Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Expand file tree Collapse file tree 2 files changed +50
-2
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ func (g *GHCRWebhook) Parse(r *http.Request) (*WebhookEvent, error) {
108108 }
109109
110110 // Only process container packages
111- if payload .Package .PackageType != "container" {
111+ if strings . ToLower ( payload .Package .PackageType ) != "container" {
112112 return nil , fmt .Errorf ("unsupported package type: %s" , payload .Package .PackageType )
113113 }
114114
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ func TestGHCRWebhook_Parse(t *testing.T) {
148148 expectError bool
149149 }{
150150 {
151- name : "valid registry package published event" ,
151+ name : "valid registry package published event with lower case package_type " ,
152152 payload : `{
153153 "action": "published",
154154 "package": {
@@ -171,6 +171,54 @@ func TestGHCRWebhook_Parse(t *testing.T) {
171171 expectedTag : "v1.0.0" ,
172172 expectError : false ,
173173 },
174+ {
175+ name : "another valid registry package published event with upper case package_type" ,
176+ payload : `{
177+ "action": "published",
178+ "package": {
179+ "name": "myapp",
180+ "package_type": "CONTAINER",
181+ "owner": {
182+ "login": "myuser"
183+ },
184+ "package_version": {
185+ "name": "v1.0.0",
186+ "container_metadata": {
187+ "tag": {
188+ "name": "v1.0.0"
189+ }
190+ }
191+ }
192+ }
193+ }` ,
194+ expectedRepo : "myuser/myapp" ,
195+ expectedTag : "v1.0.0" ,
196+ expectError : false ,
197+ },
198+ {
199+ name : "another valid registry package published event with camel case package_type" ,
200+ payload : `{
201+ "action": "published",
202+ "package": {
203+ "name": "myapp",
204+ "package_type": "Container",
205+ "owner": {
206+ "login": "myuser"
207+ },
208+ "package_version": {
209+ "name": "v1.0.0",
210+ "container_metadata": {
211+ "tag": {
212+ "name": "v1.0.0"
213+ }
214+ }
215+ }
216+ }
217+ }` ,
218+ expectedRepo : "myuser/myapp" ,
219+ expectedTag : "v1.0.0" ,
220+ expectError : false ,
221+ },
174222 {
175223 name : "valid registry package published event with latest tag" ,
176224 payload : `{
You can’t perform that action at this time.
0 commit comments