Browse Source
Update storage provider StoreExisting method to take absolute file paths
feature/update-route-registration
Roman Zipp
3 years ago
committed by
Fabian Vowie
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
2 changed files with
3 additions and
2 deletions
-
storage/storage.go
-
storage/storage_test.go
|
|
@ -34,7 +34,7 @@ func (sp FileSystemStorageProvider) StoreRaw(bucketName string, objectName strin |
|
|
|
} |
|
|
|
|
|
|
|
func (sp FileSystemStorageProvider) StoreExisting(bucketName string, objectName string, existingFilePath string) (string, error) { |
|
|
|
bytesRead, err := afero.ReadFile(sp.fileSystem, existingFilePath) |
|
|
|
bytesRead, err := os.ReadFile(existingFilePath) |
|
|
|
if err != nil { |
|
|
|
return "", err |
|
|
|
} |
|
|
|
|
|
@ -33,7 +33,8 @@ func TestFileSystemStorageProvider(t *testing.T) { |
|
|
|
t.Run("storeExisting method stores files in filesystem", func(t *testing.T) { |
|
|
|
fileSystem := afero.NewMemMapFs() |
|
|
|
|
|
|
|
afero.WriteFile(fileSystem, "/tmp/existing.bin", dummyData, os.ModePerm) |
|
|
|
err := os.WriteFile("/tmp/existing.bin", dummyData, os.ModePerm) |
|
|
|
assert.Nil(t, err) |
|
|
|
|
|
|
|
provider := FileSystemStorageProvider{ |
|
|
|
fileSystem: fileSystem, |
|
|
|