Browse Source

Cleanup duplicate code in storeExisting method

feature/add-storage-layer
Fabian Vowie 3 years ago
parent
commit
3a15614ca9
No known key found for this signature in database GPG Key ID: C27317C33B27C410
  1. 8
      storage/storage.go

8
storage/storage.go

@ -28,12 +28,6 @@ func (sp FileSystemStorageProvider) storeRaw(bucketName string, objectName strin
}
func (sp FileSystemStorageProvider) storeExisting(bucketName string, objectName string, existingFilePath string) {
directoryPath := filepath.Join(sp.basePath, bucketName)
sp.fileSystem.MkdirAll(directoryPath, os.ModePerm)
filePath := filepath.Join(directoryPath, objectName)
bytesRead, _ := afero.ReadFile(sp.fileSystem, existingFilePath)
afero.WriteFile(sp.fileSystem, filePath, bytesRead, os.ModePerm)
sp.storeRaw(bucketName, objectName, bytesRead)
}
Loading…
Cancel
Save