Browse Source
Add storage provider error handling on reading existing files
Roman Zipp
3 years ago
committed by
Fabian Vowie
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
1 changed files with
4 additions and
1 deletions
-
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) { |
|
|
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) |
|
|
return sp.StoreRaw(bucketName, objectName, bytesRead) |
|
|
} |
|
|
} |
|
|