Fix assignment to shadowed variable
This fixes the request that creates the address book returning an error even though it was successfully created and read.
This commit is contained in:
parent
196503553a
commit
b99f38a1b7
@ -235,8 +235,8 @@ func (b *filesystemBackend) AddressBook(ctx context.Context) (*carddav.AddressBo
|
|||||||
|
|
||||||
debug.Printf("loading addressbook from %s", path)
|
debug.Printf("loading addressbook from %s", path)
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(path)
|
data, readErr := ioutil.ReadFile(path)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(readErr) {
|
||||||
urlPath, err := b.AddressbookHomeSetPath(ctx)
|
urlPath, err := b.AddressbookHomeSetPath(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -246,9 +246,9 @@ func (b *filesystemBackend) AddressBook(ctx context.Context) (*carddav.AddressBo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
data, err = ioutil.ReadFile(path)
|
data, readErr = ioutil.ReadFile(path)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if readErr != nil {
|
||||||
return nil, fmt.Errorf("error opening address book: %s", err.Error())
|
return nil, fmt.Errorf("error opening address book: %s", err.Error())
|
||||||
}
|
}
|
||||||
var addressBook carddav.AddressBook
|
var addressBook carddav.AddressBook
|
||||||
@ -492,7 +492,7 @@ func (b *filesystemBackend) Calendar(ctx context.Context) (*caldav.Calendar, err
|
|||||||
|
|
||||||
debug.Printf("loading calendar from %s", path)
|
debug.Printf("loading calendar from %s", path)
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(path)
|
data, readErr := ioutil.ReadFile(path)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
homeSetPath, err := b.CalendarHomeSetPath(ctx)
|
homeSetPath, err := b.CalendarHomeSetPath(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -503,9 +503,9 @@ func (b *filesystemBackend) Calendar(ctx context.Context) (*caldav.Calendar, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
data, err = ioutil.ReadFile(path)
|
data, readErr = ioutil.ReadFile(path)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if readErr != nil {
|
||||||
return nil, fmt.Errorf("error opening calendar: %s", err.Error())
|
return nil, fmt.Errorf("error opening calendar: %s", err.Error())
|
||||||
}
|
}
|
||||||
var calendar caldav.Calendar
|
var calendar caldav.Calendar
|
||||||
|
Loading…
Reference in New Issue
Block a user