Commit d6c0c5c
committed
fix(backend): close the ReadCloser returned by PullBlob in push
pushIfNotExist pulled each blob's content from the source storage and then
handed it to Blobs().Push wrapped in io.NopCloser. The NopCloser is there
on purpose (Close on the distribution reader returns an error, see #50),
but it also means the original ReadCloser from PullBlob was never closed
on any path, leaking a file descriptor or HTTP body per blob.
Add a `defer content.Close()` immediately after the nil-error check so the
original reader is released on both success and error paths. The existing
NopCloser wrapper still prevents Push from calling Close itself, so the
workaround for #50 is preserved.
Fixes #491
Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>1 parent 73e3a9c commit d6c0c5c
1 file changed
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
| |||
0 commit comments