mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
This commit is contained in:
@@ -441,12 +441,12 @@ func UploadSpider(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 发起同步
|
||||
services.PublishAllSpiders()
|
||||
|
||||
// 获取爬虫
|
||||
spider = model.GetSpiderByName(spiderName)
|
||||
|
||||
// 发起同步
|
||||
services.PublishSpider(spider)
|
||||
|
||||
c.JSON(http.StatusOK, Response{
|
||||
Status: "ok",
|
||||
Message: "success",
|
||||
|
||||
@@ -149,10 +149,9 @@ func DeCompress(srcFile *os.File, dstPath string) error {
|
||||
}
|
||||
|
||||
// 如果文件目录不存在,则创建一个
|
||||
dirPath := filepath.Dir(innerFile.Name)
|
||||
dirPath := filepath.Join(dstPath, filepath.Dir(innerFile.Name))
|
||||
if !Exists(dirPath) {
|
||||
err = os.MkdirAll(filepath.Join(dstPath, dirPath), os.ModeDir|os.ModePerm)
|
||||
if err != nil {
|
||||
if err = os.MkdirAll(dirPath, os.ModeDir|os.ModePerm); err != nil {
|
||||
log.Errorf("Unzip File Error : " + err.Error())
|
||||
debug.PrintStack()
|
||||
return err
|
||||
@@ -168,7 +167,8 @@ func DeCompress(srcFile *os.File, dstPath string) error {
|
||||
}
|
||||
|
||||
// 创建新文件
|
||||
newFile, err := os.OpenFile(filepath.Join(dstPath, innerFile.Name), os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
|
||||
newFilePath := filepath.Join(dstPath, innerFile.Name)
|
||||
newFile, err := os.OpenFile(newFilePath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, info.Mode())
|
||||
if err != nil {
|
||||
log.Errorf("Unzip File Error : " + err.Error())
|
||||
debug.PrintStack()
|
||||
|
||||
Reference in New Issue
Block a user