Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e9e233

Browse files
committed
* prevent file being opened twice
1 parent c767c32 commit 0e9e233

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

remote_fetch.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ func decompressSingleFile(file *zip.File, cacheLocation string) error {
130130
}
131131
}()
132132

133-
if err := os.WriteFile(tmp.Name(), archiveBytes, file.FileHeader.Mode()); err != nil {
133+
if _, err := tmp.Write(archiveBytes); err != nil {
134134
return errorExtractingPostgres(err)
135135
}
136136

137-
// Windows cannot rename a file if is it still open.
138-
// The file needs to be manually closed to allow the rename to happen
139-
if err := tmp.Close(); err != nil {
140-
return errorExtractingPostgres(err)
141-
}
137+
//// Windows cannot rename a file if is it still open.
138+
//// The file needs to be manually closed to allow the rename to happen
139+
//if err := tmp.Close(); err != nil {
140+
// return errorExtractingPostgres(err)
141+
//}
142142

143143
if err := renameOrIgnore(tmp.Name(), cacheLocation); err != nil {
144144
return errorExtractingPostgres(err)

0 commit comments

Comments
 (0)