mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 03:18:24 +00:00 
			
		
		
		
	#1064: X-Gogs-Event header is empty
This commit is contained in:
		
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							| @@ -17,7 +17,7 @@ import ( | |||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const APP_VER = "0.5.16.0317 Beta" | const APP_VER = "0.5.16.0318 Beta" | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
|   | |||||||
| @@ -417,32 +417,28 @@ func CommitRepoAction(userId, repoUserId int64, userName, actEmail string, | |||||||
| 			continue | 			continue | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		var payload BasePayload | ||||||
| 		switch w.HookTaskType { | 		switch w.HookTaskType { | ||||||
| 		case SLACK: | 		case SLACK: | ||||||
| 			{ |  | ||||||
| 			s, err := GetSlackPayload(p, w.Meta) | 			s, err := GetSlackPayload(p, w.Meta) | ||||||
| 			if err != nil { | 			if err != nil { | ||||||
| 				return errors.New("action.GetSlackPayload: " + err.Error()) | 				return errors.New("action.GetSlackPayload: " + err.Error()) | ||||||
| 			} | 			} | ||||||
| 				CreateHookTask(&HookTask{ | 			payload = s | ||||||
| 					Type:        w.HookTaskType, |  | ||||||
| 					Url:         w.Url, |  | ||||||
| 					BasePayload: s, |  | ||||||
| 					ContentType: w.ContentType, |  | ||||||
| 					IsSsl:       w.IsSsl, |  | ||||||
| 				}) |  | ||||||
| 			} |  | ||||||
| 		default: | 		default: | ||||||
| 			{ | 			payload = p | ||||||
| 			p.Secret = w.Secret | 			p.Secret = w.Secret | ||||||
| 				CreateHookTask(&HookTask{ | 		} | ||||||
|  |  | ||||||
|  | 		if err = CreateHookTask(&HookTask{ | ||||||
| 			Type:        w.HookTaskType, | 			Type:        w.HookTaskType, | ||||||
| 			Url:         w.Url, | 			Url:         w.Url, | ||||||
| 					BasePayload: p, | 			BasePayload: payload, | ||||||
| 			ContentType: w.ContentType, | 			ContentType: w.ContentType, | ||||||
|  | 			EventType:   HOOK_EVENT_PUSH, | ||||||
| 			IsSsl:       w.IsSsl, | 			IsSsl:       w.IsSsl, | ||||||
| 				}) | 		}); err != nil { | ||||||
| 			} | 			return fmt.Errorf("CreateHookTask: %v", err) | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -205,7 +205,7 @@ func IsValidHookTaskType(name string) bool { | |||||||
| type HookEventType string | type HookEventType string | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	PUSH HookEventType = "push" | 	HOOK_EVENT_PUSH HookEventType = "push" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| // FIXME: just use go-gogs-client structs maybe? | // FIXME: just use go-gogs-client structs maybe? | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 0.5.16.0317 Beta | 0.5.16.0318 Beta | ||||||
		Reference in New Issue
	
	Block a user