Skip to content

Commit

Permalink
download: fix url regexp
Browse files Browse the repository at this point in the history
For #10
  • Loading branch information
gnojus committed Oct 5, 2024
1 parent cbd77a3 commit 6ce8c85
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions transfer/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"regexp"
)

const baseApi string = "https://wetransfer.com/api/v4"

var urlRegex = regexp.MustCompile(".+/downloads/([^/]+)(/([^/]+))?/([^/]+)")
var urlRegex = regexp.MustCompile(".+/downloads/([^/]+)(/([^/]+))?/([^/?&]+)")

type headers map[string]string

Expand Down Expand Up @@ -92,7 +92,7 @@ func getDownloadLink(client *http.Client, data transferData) (URL string, err er
if err != nil {
return
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return
}
Expand All @@ -116,7 +116,7 @@ func getDownloadLink(client *http.Client, data transferData) (URL string, err er

func getTransferData(resp *http.Response) (out transferData, err error) {
defer resp.Body.Close()
_, err = ioutil.ReadAll(resp.Body)
_, err = io.ReadAll(resp.Body)
if err != nil {
return
}
Expand Down

0 comments on commit 6ce8c85

Please sign in to comment.