@@ -221,7 +221,7 @@ func (s *Storage) IsSameV2(ctx context.Context, localPath, remotePath string) bo
221221 case enum .SymlinkFile :
222222 if isDir , _ := helper .IsDir (localPath ); ! isDir {
223223 log .Debugf ("SymlinkFile %s" , localPath )
224- localMd5 , err = helper .Md5 (localPath )
224+ localMd5 , err = helper .FileMd5 (localPath )
225225 if err != nil {
226226 log .Errorf ("MD5 error: %s" , err .Error ())
227227 return false
@@ -237,11 +237,7 @@ func (s *Storage) IsSameV2(ctx context.Context, localPath, remotePath string) bo
237237 // 获取目标地址
238238 target , _ := helper .GetSymlinkTarget (localPath )
239239 // 计算md5值
240- localMd5 , err = helper .Md5 (target )
241- if err != nil {
242- log .Errorf ("MD5 error: %s" , err .Error ())
243- return false
244- }
240+ localMd5 = helper .StringMd5 (target )
245241 default :
246242 return true
247243 }
@@ -285,7 +281,7 @@ func (s *Storage) IsSameV2(ctx context.Context, localPath, remotePath string) bo
285281
286282 // 计算本地文件的md5
287283 if localMd5 == "" {
288- localMd5 , _ = helper .Md5 (localPath )
284+ localMd5 , _ = helper .FileMd5 (localPath )
289285 }
290286 log .Debugf ("Compare %s, Local Md5: %s, Remote ETag: %s" , localPath , localMd5 , objectInfo .ETag )
291287 if strings .ToLower (localMd5 ) == strings .ToLower (objectInfo .ETag ) {
@@ -327,7 +323,7 @@ func (s *Storage) IsSame(ctx context.Context, localPath, localMd5, remotePath st
327323
328324 // 计算本地文件的md5
329325 if localMd5 == "" {
330- localMd5 , _ = helper .Md5 (localPath )
326+ localMd5 , _ = helper .FileMd5 (localPath )
331327 }
332328 log .Debugf ("Compare %s, Local Md5: %s, Remote ETag: %s" , remotePath , localMd5 , objectInfo .ETag )
333329 if strings .ToLower (localMd5 ) == strings .ToLower (objectInfo .ETag ) {
0 commit comments