From 3ac86afc26f9da0b8a2cf4656d76c367f7e5be3b Mon Sep 17 00:00:00 2001 From: Roman Zipp Date: Mon, 17 Jan 2022 18:43:59 +0100 Subject: [PATCH] Add storage provider error handling on reading existing files --- storage/storage.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/storage.go b/storage/storage.go index 2f63381..f4d6425 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -34,7 +34,10 @@ func (sp FileSystemStorageProvider) StoreRaw(bucketName string, objectName strin } func (sp FileSystemStorageProvider) StoreExisting(bucketName string, objectName string, existingFilePath string) (string, error) { - bytesRead, _ := afero.ReadFile(sp.fileSystem, existingFilePath) + bytesRead, err := afero.ReadFile(sp.fileSystem, existingFilePath) + if err != nil { + return "", err + } return sp.StoreRaw(bucketName, objectName, bytesRead) }