@@ -103,6 +103,8 @@ func (s *sdStore) Download(url *url.URL, toExtract bool) ([]byte, error) {
103103 continue
104104 }
105105
106+ log .Printf ("Download from %s successful." , url .String ())
107+
106108 return res , nil
107109 }
108110
@@ -172,7 +174,7 @@ func (s *sdStore) Upload(u *url.URL, filePath string, toCompress bool) error {
172174 md5Json , err := s .GenerateAndCheckMd5Json (encodedURL , filePath )
173175
174176 if err != nil && err .Error () == "Contents unchanged" {
175- log .Printf ("No change, aborting upload" )
177+ log .Printf ("No change to %s , aborting upload" , filePath )
176178 return nil
177179 }
178180
@@ -220,13 +222,16 @@ func (s *sdStore) Upload(u *url.URL, filePath string, toCompress bool) error {
220222 log .Printf ("Unable to remove zip file: %v" , err )
221223 }
222224
225+ log .Printf ("Upload to %s successful." , u .String ())
226+
223227 return nil
224228 } else {
225229 err := s .putFile (u , "text/plain" , filePath )
226230 if err != nil {
227231 log .Printf ("(Try %d of %d) error received from file upload: %v" , i + 1 , maxRetries , err )
228232 continue
229233 }
234+ log .Printf ("Upload to %s successful." , u .String ())
230235 return nil
231236 }
232237 }
@@ -279,23 +284,8 @@ func (s *sdStore) get(url *url.URL, toExtract bool) ([]byte, error) {
279284 var file * os.File
280285 var err error
281286 var dir string
282-
283- if filePath != "" {
284- dir , _ = filepath .Split (filePath )
285- err := os .MkdirAll (dir , 0777 )
286-
287- if toExtract == true {
288- filePath += ".zip"
289- }
290-
291- file , err = os .Create (filePath )
292- if err != nil {
293- return nil , err
294- }
295- defer file .Close ()
296- }
297-
298287 var urlString string
288+
299289 if toExtract == true {
300290 urlString = fmt .Sprintf ("%s%s" , url .String (), ".zip" )
301291 } else {
@@ -327,7 +317,20 @@ func (s *sdStore) get(url *url.URL, toExtract bool) ([]byte, error) {
327317
328318 // Write to file
329319 if filePath != "" {
330- _ , err := file .Write (body )
320+ dir , _ = filepath .Split (filePath )
321+ err := os .MkdirAll (dir , 0777 )
322+
323+ if toExtract == true {
324+ filePath += ".zip"
325+ }
326+
327+ file , err = os .Create (filePath )
328+ if err != nil {
329+ return nil , err
330+ }
331+ defer file .Close ()
332+
333+ _ , err = file .Write (body )
331334 if err != nil {
332335 return nil , err
333336 }
0 commit comments