mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
GODT-1381 Treat readonly folder as failure for cache on disk.
This commit is contained in:
7
internal/store/cache/disk.go
vendored
7
internal/store/cache/disk.go
vendored
@ -23,6 +23,7 @@ import (
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@ -60,6 +61,12 @@ func NewOnDiskCache(path string, cmp Compressor, opts Options) (Cache, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
file, err := ioutil.TempFile(path, "tmp")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot write to target: %w", err)
|
||||
}
|
||||
os.Remove(file.Name()) //nolint[errcheck]
|
||||
|
||||
usage := du.NewDiskUsage(path)
|
||||
|
||||
// NOTE(GODT-1158): use Available() or Free()?
|
||||
|
||||
Reference in New Issue
Block a user