Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Fix downloading files from telegram
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyaglow committed Jun 1, 2018
1 parent 955c365 commit e63827c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c *Client) ProcessCortex(input *tgbotapi.Message) error {
return err
}

j, err = newFileArtifactFromURL(link, c.TLP)
j, err = newFileArtifactFromURL(link, c.TLP, c.Bot.Client)
if err != nil {
log.Println(err.Error())
return err
Expand Down Expand Up @@ -116,8 +116,13 @@ func newArtifact(s string, tlp int) (cortex.Observable, error) {
}

// newFileArtifactFromURL makes a FileArtifact from URL
func newFileArtifactFromURL(link string, tlp int) (cortex.Observable, error) {
resp, err := http.Get(link)
func newFileArtifactFromURL(link string, tlp int, client *http.Client) (cortex.Observable, error) {
req, err := http.NewRequest("GET", link, nil)
if err != nil {
return nil, err
}

resp, err := client.Do(req)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e63827c

Please sign in to comment.