From 3a15614ca9defbc373abd9e893a9dc3d4a6c1727 Mon Sep 17 00:00:00 2001 From: Fabian Vowie Date: Sat, 15 Jan 2022 14:38:41 +0100 Subject: [PATCH] Cleanup duplicate code in storeExisting method --- storage/storage.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index 79079fe..efb1db9 100644 --- a/storage/storage.go +++ b/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) }