fix md5值不一致的问题

This commit is contained in:
陈景阳
2019-10-07 12:49:37 +08:00
parent dabf5cacf1
commit 4a40d38844

View File

@@ -16,6 +16,7 @@ import (
"os"
"path/filepath"
"runtime/debug"
"strings"
)
type SpiderFileData struct {
@@ -144,6 +145,9 @@ func PublishSpider(spider model.Spider) {
}
// md5值不一样则下载
md5Str := utils.ReadFileOneLine(md5)
// 去掉空格以及换行符
md5Str = strings.Replace(md5Str, " ", "", -1)
md5Str = strings.Replace(md5Str, "\n", "", -1)
if gfFile.Md5 != md5Str {
log.Infof("md5 is different, gf-md5:%s, file-md5:%s", gfFile.Md5, md5Str)
spiderSync.RemoveSpiderFile()