mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-11 03:39:17 +00:00
feat: add ability to set default profile picture (#1061)
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
This commit is contained in:
@@ -239,3 +239,17 @@ func IsWritableDir(dir string) (bool, error) {
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// OpenFileWithSize opens a file and returns its size
|
||||
func OpenFileWithSize(path string) (io.ReadCloser, int64, error) {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
info, err := f.Stat()
|
||||
if err != nil {
|
||||
f.Close()
|
||||
return nil, 0, err
|
||||
}
|
||||
return f, info.Size(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user