File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -248,15 +248,24 @@ func (c *Client) Get() error {
248
248
// If we're not downloading a directory, then just download the file
249
249
// and return.
250
250
if mode == ClientModeFile {
251
- err := g .GetFile (dst , u )
252
- if err != nil {
253
- return err
254
- }
255
-
251
+ getFile := true
256
252
if checksumHash != nil {
257
- if err := checksum (dst , checksumHash , checksumValue ); err != nil {
253
+ if err := checksum (dst , checksumHash , checksumValue ); err == nil {
254
+ // don't get the file if the checksum of dst is correct
255
+ getFile = false
256
+ }
257
+ }
258
+ if getFile {
259
+ err := g .GetFile (dst , u )
260
+ if err != nil {
258
261
return err
259
262
}
263
+
264
+ if checksumHash != nil {
265
+ if err := checksum (dst , checksumHash , checksumValue ); err != nil {
266
+ return err
267
+ }
268
+ }
260
269
}
261
270
262
271
if decompressor != nil {
You can’t perform that action at this time.
0 commit comments