mirror of
https://github.com/AlistGo/alist.git
synced 2025-04-23 05:44:04 +08:00
fix: hash gcid empty file (#5394)
This commit is contained in:
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 {
|
||||
if hashm, ok := h.hash.(encoding.BinaryMarshaler); ok {
|
||||
if hashum, ok := h.hash.(encoding.BinaryUnmarshaler); ok {
|
||||
tempData, _ := hashm.MarshalBinary()
|
||||
h.hash.Write(h.hashState.Sum(nil))
|
||||
defer hashum.UnmarshalBinary(tempData)
|
||||
if h.offset != 0 {
|
||||
if hashm, ok := h.hash.(encoding.BinaryMarshaler); ok {
|
||||
if hashum, ok := h.hash.(encoding.BinaryUnmarshaler); ok {
|
||||
tempData, _ := hashm.MarshalBinary()
|
||||
defer hashum.UnmarshalBinary(tempData)
|
||||
h.hash.Write(h.hashState.Sum(nil))
|
||||
}
|
||||
}
|
||||
}
|
||||
return h.hash.Sum(b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user