1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-25 10:05:58 +01:00

Create directories for subgroups.

This commit is contained in:
Juliusz Chroboczek 2024-04-14 00:50:11 +02:00
parent da4a225e96
commit bbd9ef1f5c
2 changed files with 20 additions and 1 deletions

View file

@ -380,7 +380,14 @@ func rewriteDescriptionFile(filename string, desc *Description) error {
return ErrDescriptionsNotWritable
}
f, err := os.CreateTemp(path.Dir(filename), "*.temp")
dir := filepath.Dir(filename)
err = os.MkdirAll(dir, 0700)
if err != nil {
return err
}
f, err := os.CreateTemp(dir, "*.temp")
if err != nil {
return err
}

View file

@ -306,3 +306,15 @@ func TestWritableGroups(t *testing.T) {
)
}
}
func TestSubGroup(t *testing.T) {
err := setupTest(t.TempDir(), t.TempDir(), true)
if err != nil {
t.Fatalf("setupTest: %v", err)
}
err = UpdateDescription("dir/test", "", &Description{})
if err != nil {
t.Fatalf("UpdateDescription: got %v", err)
}
}