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
parent
commit
33d6072afb
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  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) {
bytesRead, err := afero.ReadFile(sp.fileSystem, existingFilePath)
bytesRead, err := os.ReadFile(existingFilePath)
if err != nil {
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) {
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,

Loading…
Cancel
Save