Update dependencies

This commit is contained in:
Lena Fuhrimann 2017-04-19 14:18:58 +02:00
parent 0c6ab519c6
commit ae3afae893
5 changed files with 19 additions and 7 deletions

View file

@ -113,7 +113,10 @@ func TestBucketViewHandler(t *testing.T) {
url := fmt.Sprintf("%s/buckets/%s", ts.URL, tc.bucketName) url := fmt.Sprintf("%s/buckets/%s", ts.URL, tc.bucketName)
resp, err := http.Get(url) resp, err := http.Get(url)
assert.NoError(err, tcID) assert.NoError(err, tcID)
defer resp.Body.Close() defer func() {
err = resp.Body.Close()
assert.NoError(err, tcID)
}()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
assert.NoError(err, tcID) assert.NoError(err, tcID)

View file

@ -3,6 +3,7 @@ package main
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"log"
"net/http" "net/http"
"github.com/gorilla/mux" "github.com/gorilla/mux"
@ -63,7 +64,12 @@ func CreateObjectFromFormHandler(s3 S3Client) http.Handler {
handleHTTPError(w, http.StatusInternalServerError, err) handleHTTPError(w, http.StatusInternalServerError, err)
return return
} }
defer file.Close() defer func() {
err = file.Close()
if err != nil {
log.Fatalln(err)
}
}()
_, err = s3.PutObject(vars["bucketName"], handler.Filename, file, contentTypeOctetStream) _, err = s3.PutObject(vars["bucketName"], handler.Filename, file, contentTypeOctetStream)
if err != nil { if err != nil {

View file

@ -46,7 +46,10 @@ func TestGetObjectHandler(t *testing.T) {
url := fmt.Sprintf("%s/buckets/%s/objects/%s", ts.URL, tc.bucketName, tc.objectName) url := fmt.Sprintf("%s/buckets/%s/objects/%s", ts.URL, tc.bucketName, tc.objectName)
resp, err := http.Get(url) resp, err := http.Get(url)
assert.NoError(err, tcID) assert.NoError(err, tcID)
defer resp.Body.Close() defer func() {
err = resp.Body.Close()
assert.NoError(err, tcID)
}()
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
assert.NoError(err, tcID) assert.NoError(err, tcID)

View file

@ -34,7 +34,7 @@ func (s S3ClientMock) ListBuckets() ([]minio.BucketInfo, error) {
} }
// ListObjectsV2 mocks minio.Client.ListObjectsV2 // ListObjectsV2 mocks minio.Client.ListObjectsV2
func (s S3ClientMock) ListObjectsV2(bucketName string, p string, r bool, d <-chan struct{}) <-chan minio.ObjectInfo { func (s S3ClientMock) ListObjectsV2(name string, p string, r bool, d <-chan struct{}) <-chan minio.ObjectInfo {
// Add error if exists // Add error if exists
if s.Err != nil { if s.Err != nil {
s.Objects = append(s.Objects, minio.ObjectInfo{ s.Objects = append(s.Objects, minio.ObjectInfo{
@ -45,7 +45,7 @@ func (s S3ClientMock) ListObjectsV2(bucketName string, p string, r bool, d <-cha
// Check if bucket exists // Check if bucket exists
found := false found := false
for _, b := range s.Buckets { for _, b := range s.Buckets {
if b.Name == bucketName { if b.Name == name {
found = true found = true
break break
} }

View file

@ -10,7 +10,7 @@
<title>S3 Manager</title> <title>S3 Manager</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/css/materialize.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/css/materialize.min.css">
</head> </head>
<body> <body>
@ -18,7 +18,7 @@
{{ template "content" . }} {{ template "content" . }}
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.1/js/materialize.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/js/materialize.min.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
$('.modal').modal(); $('.modal').modal();