@@ -98,17 +98,18 @@ func (ic *ImmichClient) uploadAsset(ctx context.Context, la *assets.Asset, endPo
98
98
switch endPoint {
99
99
case EndPointAssetUpload :
100
100
errCall = ic .newServerCall (ctx , EndPointAssetUpload ).
101
- do (postRequest ("/assets" , m .FormDataContentType (), setContextValue (callValues ), setAcceptJSON (), setBody (body )), responseJSON (& ar ))
101
+ do (postRequest ("/assets" , m .FormDataContentType (), setContextValue (callValues ), setAcceptJSON (), setImmichChecksum ( la ), setBody (body )), responseJSON (& ar ))
102
102
case EndPointAssetReplace :
103
103
errCall = ic .newServerCall (ctx , EndPointAssetReplace ).
104
- do (putRequest ("/assets/" + replaceID + "/original" , setContextValue (callValues ), setAcceptJSON (), setContentType (m .FormDataContentType ()), setBody (body )), responseJSON (& ar ))
104
+ do (putRequest ("/assets/" + replaceID + "/original" , setContextValue (callValues ), setAcceptJSON (), setImmichChecksum ( la ), setContentType (m .FormDataContentType ()), setBody (body )), responseJSON (& ar ))
105
105
}
106
106
err = errors .Join (err , errCall )
107
107
return ar , err
108
108
}
109
109
110
110
func (ic * ImmichClient ) prepareCallValues (la * assets.Asset , s fs.FileInfo , ext , mtype string ) map [string ]string {
111
111
callValues := map [string ]string {}
112
+
112
113
callValues ["deviceAssetId" ] = fmt .Sprintf ("%s-%d" , path .Base (la .OriginalFileName ), s .Size ())
113
114
callValues ["deviceId" ] = ic .DeviceUUID
114
115
callValues ["assetType" ] = mtype
0 commit comments