diff --git a/cmd/server/download.go b/cmd/server/download.go index fed6b803..169d4b19 100644 --- a/cmd/server/download.go +++ b/cmd/server/download.go @@ -273,6 +273,9 @@ func (s *searcher) refreshData(initialDir string) (*DownloadStats, error) { lastDataRefreshFailure.WithLabelValues("SDNs").Set(float64(time.Now().Unix())) stats.Errors = append(stats.Errors, fmt.Errorf("OFAC: %v", err)) } + if results == nil { + results = &ofac.Results{} + } sdns := precomputeSDNs(results.SDNs, results.Addresses, s.pipe) adds := precomputeAddresses(results.Addresses) diff --git a/pkg/download/client.go b/pkg/download/client.go index 8c88bea6..24ad508e 100644 --- a/pkg/download/client.go +++ b/pkg/download/client.go @@ -60,10 +60,8 @@ func (dl *Downloader) GetFiles(dir string, namesAndSources map[string]string) (m } // Check the initial directory for files we don't need to download - localFiles, err := os.ReadDir(dir) - if err != nil { - return nil, fmt.Errorf("readdir %s: %v", dir, err) - } + // do not treat an nonexisting directory as error + localFiles, _ := os.ReadDir(dir) var mu sync.Mutex out := make(map[string]io.ReadCloser)