2020-07-27 11:47:32 +00:00
|
|
|
package cwhub
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"crypto/sha256"
|
2023-07-06 08:14:45 +00:00
|
|
|
"errors"
|
2020-07-27 11:47:32 +00:00
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
"os"
|
2022-05-24 13:46:48 +00:00
|
|
|
"path/filepath"
|
2020-07-27 11:47:32 +00:00
|
|
|
"strings"
|
|
|
|
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"gopkg.in/yaml.v2"
|
2023-07-06 08:14:45 +00:00
|
|
|
|
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/csconfig"
|
2020-07-27 11:47:32 +00:00
|
|
|
)
|
|
|
|
|
2023-05-17 09:20:53 +00:00
|
|
|
var ErrIndexNotFound = fmt.Errorf("index not found")
|
|
|
|
|
2021-03-24 17:16:17 +00:00
|
|
|
func UpdateHubIdx(hub *csconfig.Hub) error {
|
|
|
|
bidx, err := DownloadHubIdx(hub)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("failed to download index: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
ret, err := LoadPkgIndex(bidx)
|
|
|
|
if err != nil {
|
2023-10-09 19:33:35 +00:00
|
|
|
if !errors.Is(err, ErrMissingReference) {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("failed to read index: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-11-30 09:37:17 +00:00
|
|
|
hubIdx = ret
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 19:33:35 +00:00
|
|
|
if _, err := LocalSync(hub); err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("failed to sync: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-03-24 17:16:17 +00:00
|
|
|
func DownloadHubIdx(hub *csconfig.Hub) ([]byte, error) {
|
2020-11-30 09:37:17 +00:00
|
|
|
log.Debugf("fetching index from branch %s (%s)", HubBranch, fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile))
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-08-16 07:46:10 +00:00
|
|
|
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(RawFileURLTemplate, HubBranch, HubIndexFile), nil)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return nil, fmt.Errorf("failed to build request for hub index: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
resp, err := http.DefaultClient.Do(req)
|
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return nil, fmt.Errorf("failed http request for hub index: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-05-17 09:20:53 +00:00
|
|
|
defer resp.Body.Close()
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-09-06 11:55:03 +00:00
|
|
|
if resp.StatusCode != http.StatusOK {
|
2023-05-17 09:20:53 +00:00
|
|
|
if resp.StatusCode == http.StatusNotFound {
|
|
|
|
return nil, ErrIndexNotFound
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-11-30 09:37:17 +00:00
|
|
|
return nil, fmt.Errorf("bad http code %d while requesting %s", resp.StatusCode, req.URL.String())
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-09-06 11:55:03 +00:00
|
|
|
body, err := io.ReadAll(resp.Body)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return nil, fmt.Errorf("failed to read request answer for hub index: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2022-10-28 11:55:59 +00:00
|
|
|
|
|
|
|
oldContent, err := os.ReadFile(hub.HubIndexFile)
|
|
|
|
if err != nil {
|
|
|
|
if !os.IsNotExist(err) {
|
|
|
|
log.Warningf("failed to read hub index: %s", err)
|
|
|
|
}
|
|
|
|
} else if bytes.Equal(body, oldContent) {
|
|
|
|
log.Info("hub index is up to date")
|
|
|
|
// write it anyway, can't hurt
|
|
|
|
}
|
|
|
|
|
2021-03-24 17:16:17 +00:00
|
|
|
file, err := os.OpenFile(hub.HubIndexFile, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
|
2020-07-27 11:47:32 +00:00
|
|
|
|
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return nil, fmt.Errorf("while opening hub index file: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
defer file.Close()
|
|
|
|
|
2023-08-25 14:22:10 +00:00
|
|
|
wsize, err := file.Write(body)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return nil, fmt.Errorf("while writing hub index file: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-03-24 17:16:17 +00:00
|
|
|
log.Infof("Wrote new %d bytes index to %s", wsize, hub.HubIndexFile)
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
return body, nil
|
|
|
|
}
|
|
|
|
|
2023-05-17 09:20:53 +00:00
|
|
|
// DownloadLatest will download the latest version of Item to the tdir directory
|
2023-10-09 11:26:34 +00:00
|
|
|
func DownloadLatest(hub *csconfig.Hub, target *Item, overwrite bool, updateOnly bool) error {
|
2020-07-27 11:47:32 +00:00
|
|
|
var err error
|
2020-11-30 09:37:17 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
log.Debugf("Downloading %s %s", target.Type, target.Name)
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-05-24 13:46:48 +00:00
|
|
|
if target.Type != COLLECTIONS {
|
|
|
|
if !target.Installed && updateOnly && target.Downloaded {
|
|
|
|
log.Debugf("skipping upgrade of %s : not installed", target.Name)
|
2023-10-09 11:26:34 +00:00
|
|
|
return nil
|
2022-05-24 13:46:48 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-05-24 13:46:48 +00:00
|
|
|
return DownloadItem(hub, target, overwrite)
|
|
|
|
}
|
2022-02-01 21:08:06 +00:00
|
|
|
|
2022-05-24 13:46:48 +00:00
|
|
|
// collection
|
|
|
|
var tmp = [][]string{target.Parsers, target.PostOverflows, target.Scenarios, target.Collections}
|
|
|
|
for idx, ptr := range tmp {
|
|
|
|
ptrtype := ItemTypes[idx]
|
|
|
|
for _, p := range ptr {
|
|
|
|
val, ok := hubIdx[ptrtype][p]
|
|
|
|
if !ok {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("required %s %s of %s doesn't exist, abort", ptrtype, p, target.Name)
|
2022-05-24 13:46:48 +00:00
|
|
|
}
|
2022-04-19 10:07:35 +00:00
|
|
|
|
2022-05-24 13:46:48 +00:00
|
|
|
if !val.Installed && updateOnly && val.Downloaded {
|
|
|
|
log.Debugf("skipping upgrade of %s : not installed", target.Name)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Debugf("Download %s sub-item : %s %s (%t -> %t)", target.Name, ptrtype, p, target.Installed, updateOnly)
|
|
|
|
//recurse as it's a collection
|
|
|
|
if ptrtype == COLLECTIONS {
|
|
|
|
log.Tracef("collection, recurse")
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
err = DownloadLatest(hub, &val, overwrite, updateOnly)
|
2022-02-01 21:08:06 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while downloading %s: %w", val.Name, err)
|
2022-02-01 21:08:06 +00:00
|
|
|
}
|
2022-05-24 13:46:48 +00:00
|
|
|
}
|
2023-10-09 19:33:35 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
downloaded := val.Downloaded
|
2023-10-09 19:33:35 +00:00
|
|
|
|
|
|
|
err = DownloadItem(hub, &val, overwrite)
|
2022-05-24 13:46:48 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while downloading %s: %w", val.Name, err)
|
2022-05-24 13:46:48 +00:00
|
|
|
}
|
2021-02-04 16:17:51 +00:00
|
|
|
|
2022-05-24 13:46:48 +00:00
|
|
|
// We need to enable an item when it has been added to a collection since latest release of the collection.
|
|
|
|
// We check if val.Downloaded is false because maybe the item has been disabled by the user.
|
2023-10-09 11:26:34 +00:00
|
|
|
if !val.Installed && !downloaded {
|
|
|
|
if err = EnableItem(hub, &val); err != nil {
|
|
|
|
return fmt.Errorf("enabling '%s': %w", val.Name, err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
hubIdx[ptrtype][p] = val
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2022-05-24 13:46:48 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
err = DownloadItem(hub, target, overwrite)
|
2022-05-24 13:46:48 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("failed to download item: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
return nil
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
func DownloadItem(hub *csconfig.Hub, target *Item, overwrite bool) error {
|
2023-10-03 09:20:56 +00:00
|
|
|
tdir := hub.HubDir
|
|
|
|
|
|
|
|
// if user didn't --force, don't overwrite local, tainted, up-to-date files
|
2020-07-27 11:47:32 +00:00
|
|
|
if !overwrite {
|
|
|
|
if target.Tainted {
|
|
|
|
log.Debugf("%s : tainted, not updated", target.Name)
|
2023-10-09 11:26:34 +00:00
|
|
|
return nil
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
if target.UpToDate {
|
2021-08-19 07:08:20 +00:00
|
|
|
// We still have to check if data files are present
|
2023-10-03 09:20:56 +00:00
|
|
|
log.Debugf("%s : up-to-date, not updated", target.Name)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-08-16 07:46:10 +00:00
|
|
|
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf(RawFileURLTemplate, HubBranch, target.RemotePath), nil)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while downloading %s: %w", req.URL.String(), err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
resp, err := http.DefaultClient.Do(req)
|
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while downloading %s: %w", req.URL.String(), err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-09-06 11:55:03 +00:00
|
|
|
if resp.StatusCode != http.StatusOK {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("bad http code %d for %s", resp.StatusCode, req.URL.String())
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
defer resp.Body.Close()
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-09-06 11:55:03 +00:00
|
|
|
body, err := io.ReadAll(resp.Body)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while reading %s: %w", req.URL.String(), err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
h := sha256.New()
|
2023-10-09 19:33:35 +00:00
|
|
|
if _, err = h.Write(body); err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while hashing %s: %w", target.Name, err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
meow := fmt.Sprintf("%x", h.Sum(nil))
|
|
|
|
if meow != target.Versions[target.Version].Digest {
|
|
|
|
log.Errorf("Downloaded version doesn't match index, please 'hub update'")
|
|
|
|
log.Debugf("got %s, expected %s", meow, target.Versions[target.Version].Digest)
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("invalid download hash for %s", target.Name)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
//all good, install
|
|
|
|
//check if parent dir exists
|
|
|
|
tmpdirs := strings.Split(tdir+"/"+target.RemotePath, "/")
|
2023-10-09 19:33:35 +00:00
|
|
|
parentDir := strings.Join(tmpdirs[:len(tmpdirs)-1], "/")
|
2020-07-27 11:47:32 +00:00
|
|
|
|
2023-10-03 09:20:56 +00:00
|
|
|
// ensure that target file is within target dir
|
2021-02-02 13:15:13 +00:00
|
|
|
finalPath, err := filepath.Abs(tdir + "/" + target.RemotePath)
|
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("filepath.Abs error on %s: %w", tdir+"/"+target.RemotePath, err)
|
2021-02-02 13:15:13 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-02-02 13:15:13 +00:00
|
|
|
if !strings.HasPrefix(finalPath, tdir) {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("path %s escapes %s, abort", target.RemotePath, tdir)
|
2021-02-02 13:15:13 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
|
|
|
// check dir
|
2023-10-09 19:33:35 +00:00
|
|
|
if _, err = os.Stat(parentDir); os.IsNotExist(err) {
|
|
|
|
log.Debugf("%s doesn't exist, create", parentDir)
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 19:33:35 +00:00
|
|
|
if err = os.MkdirAll(parentDir, os.ModePerm); err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while creating parent directories: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
|
|
|
// check actual file
|
2021-02-02 13:15:13 +00:00
|
|
|
if _, err = os.Stat(finalPath); !os.IsNotExist(err) {
|
2020-07-27 11:47:32 +00:00
|
|
|
log.Warningf("%s : overwrite", target.Name)
|
|
|
|
log.Debugf("target: %s/%s", tdir, target.RemotePath)
|
|
|
|
} else {
|
|
|
|
log.Infof("%s : OK", target.Name)
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := os.OpenFile(tdir+"/"+target.RemotePath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)
|
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while opening file: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
defer f.Close()
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-08-25 14:22:10 +00:00
|
|
|
_, err = f.Write(body)
|
2020-07-27 11:47:32 +00:00
|
|
|
if err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while writing file: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
target.Downloaded = true
|
|
|
|
target.Tainted = false
|
|
|
|
target.UpToDate = true
|
|
|
|
|
2023-10-09 19:33:35 +00:00
|
|
|
if err = downloadData(hub.InstallDataDir, overwrite, bytes.NewReader(body)); err != nil {
|
2023-10-09 11:26:34 +00:00
|
|
|
return fmt.Errorf("while downloading data for %s: %w", target.FileName, err)
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
hubIdx[target.Type][target.Name] = *target
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 11:26:34 +00:00
|
|
|
return nil
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func DownloadDataIfNeeded(hub *csconfig.Hub, target Item, force bool) error {
|
2023-10-09 19:33:35 +00:00
|
|
|
itemFilePath := fmt.Sprintf("%s/%s/%s/%s", hub.InstallDir, target.Type, target.Stage, target.FileName)
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 19:33:35 +00:00
|
|
|
itemFile, err := os.Open(itemFilePath)
|
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("while opening %s: %w", itemFilePath, err)
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-05-17 10:14:59 +00:00
|
|
|
defer itemFile.Close()
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-10-09 19:33:35 +00:00
|
|
|
if err = downloadData(hub.InstallDataDir, force, itemFile); err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("while downloading data for %s: %w", itemFilePath, err)
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-08-19 07:08:20 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func downloadData(dataFolder string, force bool, reader io.Reader) error {
|
|
|
|
var err error
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-08-19 07:08:20 +00:00
|
|
|
dec := yaml.NewDecoder(reader)
|
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
for {
|
2023-06-08 14:49:51 +00:00
|
|
|
data := &DataSet{}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2020-07-27 11:47:32 +00:00
|
|
|
err = dec.Decode(data)
|
|
|
|
if err != nil {
|
2022-11-29 08:16:07 +00:00
|
|
|
if errors.Is(err, io.EOF) {
|
|
|
|
break
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("while reading file: %w", err)
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
2021-08-19 07:08:20 +00:00
|
|
|
|
|
|
|
download := false
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2022-02-14 15:51:06 +00:00
|
|
|
for _, dataS := range data.Data {
|
2023-10-09 19:33:35 +00:00
|
|
|
if _, err = os.Stat(filepath.Join(dataFolder, dataS.DestPath)); os.IsNotExist(err) {
|
2022-02-14 15:51:06 +00:00
|
|
|
download = true
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-08-19 07:08:20 +00:00
|
|
|
if download || force {
|
2023-06-08 14:49:51 +00:00
|
|
|
err = GetData(data.Data, dataFolder)
|
2021-08-19 07:08:20 +00:00
|
|
|
if err != nil {
|
2023-07-06 08:14:45 +00:00
|
|
|
return fmt.Errorf("while getting data: %w", err)
|
2021-08-19 07:08:20 +00:00
|
|
|
}
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-03 09:20:56 +00:00
|
|
|
|
2021-08-19 07:08:20 +00:00
|
|
|
return nil
|
2020-07-27 11:47:32 +00:00
|
|
|
}
|