Add diagnostics for MKCOL failures in ensureParent method
This commit is contained in:
@@ -77,11 +77,15 @@ func (c *WebDAVClient) ensureParent(ctx context.Context, remotePath string) erro
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Read body for diagnostics
|
||||
b, _ := io.ReadAll(resp.Body)
|
||||
resp.Body.Close()
|
||||
// 201 created, 405 exists — ignore
|
||||
if resp.StatusCode == 201 || resp.StatusCode == 405 {
|
||||
continue
|
||||
}
|
||||
// Any other status is an error: return with diagnostics so caller can log and act on it
|
||||
return fmt.Errorf("MKCOL failed for %s: status=%d body=%s", mkurl, resp.StatusCode, string(b))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user