mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 18:42:58 +00:00
fix(storage): ignore os.ErrClosed
from deferred fileReader.Close()
in storage.APIUpload (#1468)
fix(provider): ignore `ErrClosed` for fileReader Signed-off-by: Keith King <KingKeithC@gmail.com>
This commit is contained in:
parent
f7c3560260
commit
e8bd1fcda7
@ -2,6 +2,7 @@ package storage
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"mime/multipart"
|
"mime/multipart"
|
||||||
@ -112,6 +113,11 @@ func (c *Client) APIUpload(
|
|||||||
defer func(fileReader *os.File) {
|
defer func(fileReader *os.File) {
|
||||||
e := fileReader.Close()
|
e := fileReader.Close()
|
||||||
if e != nil {
|
if e != nil {
|
||||||
|
if errors.Is(e, os.ErrClosed) {
|
||||||
|
// We can ignore the error in the case that the file was already closed.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
tflog.Error(ctx, "failed to close file reader", map[string]interface{}{
|
tflog.Error(ctx, "failed to close file reader", map[string]interface{}{
|
||||||
"error": e,
|
"error": e,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user