mirror of
https://github.com/gmemstr/sliproad.git
synced 2024-09-20 00:21:15 +01:00
Better error messages for Backblaze, int64.
Ran into an issue when running on a Raspberry Pi - occaisonally, the int size for the files being provided from Backblaze (which is in bytes) will be too large. This is fixed by upgrading the int to int64. As a part of this debugging process, I upgraded the error handling when fetching the Backblaze file listing to actually print the errors rather than failing silently.
This commit is contained in:
parent
f54ad74ec7
commit
9cd7ab75e8
|
@ -25,10 +25,10 @@ type BackblazeAuthPayload struct {
|
||||||
|
|
||||||
type BackblazeFile struct {
|
type BackblazeFile struct {
|
||||||
Action string `json:"action"`
|
Action string `json:"action"`
|
||||||
Size int `json:"contentLength"`
|
Size int64 `json:"contentLength"`
|
||||||
Type string `json:"contentType"`
|
Type string `json:"contentType"`
|
||||||
FileName string `json:"fileName"`
|
FileName string `json:"fileName"`
|
||||||
Timestamp int `json:"uploadTimestamp"`
|
Timestamp int64 `json:"uploadTimestamp"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type BackblazeFilePayload struct {
|
type BackblazeFilePayload struct {
|
||||||
|
@ -92,16 +92,19 @@ func (bp *BackblazeProvider) GetDirectory(path string) Directory {
|
||||||
bp.Location + "/b2api/v2/b2_list_file_names",
|
bp.Location + "/b2api/v2/b2_list_file_names",
|
||||||
bytes.NewBuffer([]byte(requestBody)))
|
bytes.NewBuffer([]byte(requestBody)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
return Directory{}
|
return Directory{}
|
||||||
}
|
}
|
||||||
req.Header.Add("Authorization", bp.Authentication)
|
req.Header.Add("Authorization", bp.Authentication)
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
return Directory{}
|
return Directory{}
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
body, err := ioutil.ReadAll(resp.Body)
|
body, err := ioutil.ReadAll(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
return Directory{}
|
return Directory{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue