mirror of
https://github.com/go-gitea/gitea
synced 2024-12-22 03:27:51 +01:00
Backport #18080 If http.Get() returns an error return nil and err before attempting to use the broken file. Thanks to walker xiong for spotting this bug. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
parent
012e45a4c1
commit
afe9d2cadd
@ -31,7 +31,10 @@ func Open(uriStr string) (io.ReadCloser, error) {
|
||||
switch strings.ToLower(u.Scheme) {
|
||||
case "http", "https":
|
||||
f, err := http.Get(uriStr)
|
||||
return f.Body, err
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f.Body, nil
|
||||
case "file":
|
||||
return os.Open(u.Path)
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user