Merge pull request #4394 from wkloucek/idp-init-empty-file

Bugfix: Autocreate IDP private key also if file exists but is empty
This commit is contained in:
Willy Kloucek
2022-08-15 12:49:49 +02:00
committed by GitHub
2 changed files with 10 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
Bugfix: Autocreate IDP private key also if file exists but is empty
We've fixed the behavior for the IDP private key generation so that
a private key is also generated when the file already exists but is empty.
https://github.com/owncloud/ocis/pull/4394

View File

@@ -161,12 +161,12 @@ func ensureEncryptionSecretExists(path string) error {
func ensureSigningPrivateKeyExists(paths []string) error {
for _, path := range paths {
_, err := os.Stat(path)
if err == nil {
// If the file exists we can just return
file, err := os.Stat(path)
if err == nil && file.Size() > 0 {
// If the file exists and is not empty we can just return
return nil
}
if !errors.Is(err, fs.ErrNotExist) {
if !errors.Is(err, fs.ErrNotExist) && file.Size() > 0 {
return err
}