Skip to content

Commit b7dcfe1

Browse files
excitonsimulot
authored andcommitted
Ignore ErrClosedPipe errors if immich has returned a duplicate status.
This is expected behaviour - the connection is closed to avoid uploading the asset when we set the x-immich-checksum header to tell immich the checksum ahead of time. So we should just ignore the closed pipe error in this case and keep going.
1 parent 172120e commit b7dcfe1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

immich/upload.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ func (ic *ImmichClient) uploadAsset(ctx context.Context, la *assets.Asset, endPo
103103
errCall = ic.newServerCall(ctx, EndPointAssetReplace).
104104
do(putRequest("/assets/"+replaceID+"/original", setContextValue(callValues), setAcceptJSON(), setImmichChecksum(la), setContentType(m.FormDataContentType()), setBody(body)), responseJSON(&ar))
105105
}
106+
if ar.Status == "duplicate" && errors.Is(err, io.ErrClosedPipe) {
107+
err = nil //immich closes the connection when we upload the x-immich-checksum header and it finds a duplicate
108+
}
106109
err = errors.Join(err, errCall)
107110
return ar, err
108111
}

0 commit comments

Comments
 (0)