mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-11-04 00:11:04 +00:00 
			
		
		
		
	Fix Issue watching / unwatching on the web ui
When subscribing or unsubscribing to/from an issue on the web ui, the request was posted to a route handled by `repo.IssueWatch`. This function used `ctx.Req.PostForm.Get()`, erroneously. `request.PostForm` is *only* available if `request.ParseForm()` has been called before it. The function in question did not do that. Under some circumstances, something, somewhere did end up calling `ParseForm()`, but not in every scenario. Since we do not need to check for multiple values, the easiest fix here is to use `ctx.Req.PostFormValue`, which will call `ParseForm()` if necessary. Fixes #3516. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
		
					parent
					
						
							
								0da02b9213
							
						
					
				
			
			
				commit
				
					
						6f35a5ab90
					
				
			
		
					 2 changed files with 2 additions and 1 deletions
				
			
		
							
								
								
									
										1
									
								
								release-notes/8.0.0/fix/3562.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								release-notes/8.0.0/fix/3562.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
Fixed a bug where subscribing to or unsubscribing from an issue in a repository with no code produced an internal server error.
 | 
			
		||||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ func IssueWatch(ctx *context.Context) {
 | 
			
		|||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	watch, err := strconv.ParseBool(ctx.Req.PostForm.Get("watch"))
 | 
			
		||||
	watch, err := strconv.ParseBool(ctx.Req.PostFormValue("watch"))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		ctx.ServerError("watch is not bool", err)
 | 
			
		||||
		return
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue