Browse Source
Cleanup duplicate code in storeExisting method
feature/add-storage-layer
Fabian Vowie
3 years ago
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
1 changed files with
1 additions and
7 deletions
-
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) { |
|
|
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) |
|
|
bytesRead, _ := afero.ReadFile(sp.fileSystem, existingFilePath) |
|
|
afero.WriteFile(sp.fileSystem, filePath, bytesRead, os.ModePerm) |
|
|
|
|
|
|
|
|
sp.storeRaw(bucketName, objectName, bytesRead) |
|
|
} |
|
|
} |