From 9898b733966cd873487705211ca35dcf7d529bb5 Mon Sep 17 00:00:00 2001 From: Matt Holt Date: Tue, 12 Dec 2023 20:04:15 -0700 Subject: [PATCH] Update archiver.go --- archiver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/archiver.go b/archiver.go index 45a5121f..1701b078 100644 --- a/archiver.go +++ b/archiver.go @@ -221,6 +221,9 @@ func openAndCopyFile(file File, w io.Writer) error { return err } defer fileReader.Close() + // When file is in use and size is being written to, creating the compressed + // file will fail with "archive/tar: write too long." Using CopyN gracefully + // handles this. _, err = io.CopyN(w, fileReader, file.Size()) if err != nil && err != io.EOF { return err