Browse Source

Update storage provider StoreExisting method to take absolute file paths

feature/add-image-processing
Roman Zipp 3 years ago
parent
commit
9692c79a26
  1. 2
      storage/storage.go
  2. 3
      storage/storage_test.go

2
storage/storage.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) { 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 { if err != nil {
return "", err return "", err
} }

3
storage/storage_test.go

@ -33,7 +33,8 @@ func TestFileSystemStorageProvider(t *testing.T) {
t.Run("storeExisting method stores files in filesystem", func(t *testing.T) { t.Run("storeExisting method stores files in filesystem", func(t *testing.T) {
fileSystem := afero.NewMemMapFs() 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{ provider := FileSystemStorageProvider{
fileSystem: fileSystem, fileSystem: fileSystem,

Loading…
Cancel
Save