mirror of https://github.com/Xhofe/alist
fix: hash gcid empty file (#5394)
parent
94d028743a
commit
cdfbe6dcf2
|
@ -72,11 +72,13 @@ func (h *gcid) Write(p []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *gcid) Sum(b []byte) []byte {
|
func (h *gcid) Sum(b []byte) []byte {
|
||||||
if hashm, ok := h.hash.(encoding.BinaryMarshaler); ok {
|
if h.offset != 0 {
|
||||||
if hashum, ok := h.hash.(encoding.BinaryUnmarshaler); ok {
|
if hashm, ok := h.hash.(encoding.BinaryMarshaler); ok {
|
||||||
tempData, _ := hashm.MarshalBinary()
|
if hashum, ok := h.hash.(encoding.BinaryUnmarshaler); ok {
|
||||||
h.hash.Write(h.hashState.Sum(nil))
|
tempData, _ := hashm.MarshalBinary()
|
||||||
defer hashum.UnmarshalBinary(tempData)
|
defer hashum.UnmarshalBinary(tempData)
|
||||||
|
h.hash.Write(h.hashState.Sum(nil))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return h.hash.Sum(b)
|
return h.hash.Sum(b)
|
||||||
|
|
Loading…
Reference in New Issue