code: func (b *Bslack) handleDownloadFile(rmsg *config.Message, file *slack.File, retry bool) error {
  	if b.fileCached(file) {
  		return nil
  	}
  	// Check that the file is neither too large nor blacklisted.
  	if err := helper.HandleDownloadSize(b.Log, rmsg, file.Name, int64(file.Size), b.General); err != nil {
  		b.Log.WithError(err).Infof("Skipping download of incoming file.")
  		return nil
  	}
  
  	// Actually download the file.
  	data, err := helper.DownloadFileAuth(file.URLPrivateDownload, "Bearer "+b.GetString(tokenConfig))
  	if err != nil {
  		return fmt.Errorf("download %s failed %#v", file.URLPrivateDownload, err)
  	}
  
  	if len(*data) != file.Size && !retry {
  		b.Log.Debugf("Data size (%d) is not equal to size declared (%d)\n", len(*data), file.Size)
  		time.Sleep(1 * time.Second)
  		return b.handleDownloadFile(rmsg, file, true)
  	}
  
  	// If a comment is attached to the file(s) it is in the 'Text' field of the Slack messge event
  	// and should be added as comment to only one of the files. We reset the 'Text' field to ensure
  	// that the comment is not duplicated.
  	comment := rmsg.Text
  	rmsg.Text = ""
  	helper.HandleDownloadData(b.Log, rmsg, file.Name, comment, file.URLPrivateDownload, data, b.General)
  	return nil
  }
docs: // handleDownloadFile handles file download