Skip to content

Commit

Permalink
retrieve: Fix function, cloning debugged.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-graves committed Apr 23, 2023
1 parent be41e5f commit b32063a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ func retrieve(oid string, size int64, action *api.Action, writer, errWriter *buf
client := createS3Client()
bucketName := os.Getenv("S3_BUCKET")

localPath := fmt.Sprintf("%s.tmp", oid)
localPath := ".git/lfs/objects/" + oid[:2] + "/" + oid[2:4] + "/" + oid
file, err := os.Create(localPath)
if err != nil {
util.WriteToStderr(fmt.Sprintf("Error creating file: %v\n", err), errWriter)
return
}
defer file.Close()
defer func() {
file.Sync()
file.Close()
}()

downloader := manager.NewDownloader(client, func(d *manager.Downloader) {
d.PartSize = 10 * 1024 * 1024 // 10 MB part size
Expand All @@ -105,6 +109,7 @@ func retrieve(oid string, size int64, action *api.Action, writer, errWriter *buf
})

if err != nil {
util.WriteToStderr(fmt.Sprintf("Error downloading file: %v\n", err), errWriter)
return
}

Expand Down

0 comments on commit b32063a

Please sign in to comment.