mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
fix bug
This commit is contained in:
@@ -116,7 +116,7 @@ func PublishSpider(spider model.Spider) {
|
||||
// 查询gf file,不存在则删除
|
||||
gfFile := model.GetGridFs(spider.FileId)
|
||||
if gfFile == nil {
|
||||
_ = model.RemoveSpider(spider.FileId)
|
||||
_ = model.RemoveSpider(spider.Id)
|
||||
return
|
||||
}
|
||||
spiderSync := spider_handler.SpiderSync{
|
||||
|
||||
@@ -93,7 +93,6 @@ func (s *SpiderSync) Download() {
|
||||
}
|
||||
}
|
||||
// 创建临时文件
|
||||
|
||||
tmpFilePath := filepath.Join(tmpPath, randomId.String()+".zip")
|
||||
tmpFile := utils.OpenFile(tmpFilePath)
|
||||
defer tmpFile.Close()
|
||||
|
||||
@@ -25,7 +25,7 @@ func ReadFile(fileName string) string {
|
||||
|
||||
// 创建文件
|
||||
func OpenFile(fileName string) *os.File {
|
||||
file, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, os.ModePerm)
|
||||
file, err := os.OpenFile(fileName, os.O_CREATE|os.O_RDWR, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Errorf("create file error: %s, file_name: %s", err.Error(), fileName)
|
||||
debug.PrintStack()
|
||||
|
||||
Reference in New Issue
Block a user