Return 404 always on error
This commit is contained in:
		
							parent
							
								
									4511c4c017
								
							
						
					
					
						commit
						9ed3fcd793
					
				
							
								
								
									
										6
									
								
								gitea.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								gitea.go
									
									
									
									
									
								
							@ -1,9 +1,7 @@
 | 
			
		||||
package gitea
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"io"
 | 
			
		||||
	"io/fs"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
@ -75,9 +73,7 @@ func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhtt
 | 
			
		||||
 | 
			
		||||
	f, err := m.Client.Open(fp, r.URL.Query().Get("ref"))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if errors.Is(err, fs.ErrNotExist) {
 | 
			
		||||
			return caddyhttp.Error(http.StatusNotFound, err)
 | 
			
		||||
		}
 | 
			
		||||
		return caddyhttp.Error(http.StatusNotFound, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, err = io.Copy(w, f)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user