mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 09:22:25 -05:00 
			
		
		
		
	[bugfix] Correctly handle range > content-length (#2395)
This commit is contained in:
		
					parent
					
						
							
								2eb8b8eeb4
							
						
					
				
			
			
				commit
				
					
						2cc264584e
					
				
			
		
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -206,10 +206,11 @@ func serveFileRange(rw http.ResponseWriter, r *http.Request, src io.Reader, rng | ||||||
| 			return | 			return | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if end > size { | 		if end >= size { | ||||||
| 			// According to the http spec if end >= size the server should return the rest of the file | 			// According to the http spec if end >= size the server should return the rest of the file | ||||||
| 			// https://www.rfc-editor.org/rfc/rfc9110#section-14.1.2-6 | 			// https://www.rfc-editor.org/rfc/rfc9110#section-14.1.2-6 | ||||||
| 			end = size - 1 | 			end = size - 1 | ||||||
|  | 			endRng = strconv.FormatInt(end, 10) | ||||||
| 		} | 		} | ||||||
| 	} else { | 	} else { | ||||||
| 		// No end supplied, implying file end | 		// No end supplied, implying file end | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue