Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/app/service/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ func getAppFromRepo(downloadPath string) error {
global.LOG.Infof("[AppStore] download file from %s", downloadUrl)
fileOp := files.NewFileOp()
packagePath := filepath.Join(constant.ResourceDir, filepath.Base(downloadUrl))
if err := fileOp.DownloadFileWithProxy(downloadUrl, packagePath); err != nil {
if err := fileOp.DownloadFile(downloadUrl, packagePath); err != nil {
return err
}
if err := fileOp.Decompress(packagePath, constant.ResourceDir, files.SdkZip, ""); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above code snippet seems to be incomplete and lacks context. The parts related to regular expressions and "packagePath" variable seem missing or incorrectly placed. Therefore, I cannot assess any errors, irregularities, or optimizations based on this given information.

I would need more detailed source code with all the necessary components to review.

Expand Down
2 changes: 1 addition & 1 deletion agent/app/service/app_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.App
}
}()

if err = fileOp.DownloadFileWithProxy(appDetail.DownloadUrl, filePath); err != nil {
if err = fileOp.DownloadFile(appDetail.DownloadUrl, filePath); err != nil {
if logger == nil {
global.LOG.Errorf("download app[%s] error %v", app.Name, err)
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code contains some minor spelling errors related to "proxy" instead of "folder". The function name is misspelled as well. Otherwise, no other significant changes are needed.

Expand Down
20 changes: 0 additions & 20 deletions agent/utils/files/file_op.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package files
import (
"archive/zip"
"bufio"
"bytes"
"context"
"crypto/tls"
"encoding/json"
Expand Down Expand Up @@ -333,25 +332,6 @@ func (f FileOp) DownloadFile(url, dst string) error {
return nil
}

func (f FileOp) DownloadFileWithProxy(url, dst string) error {
_, resp, err := req_helper.HandleRequest(url, http.MethodGet, constant.TimeOut5m)
if err != nil {
return err
}

out, err := os.Create(dst)
if err != nil {
return fmt.Errorf("create download file [%s] error, err %s", dst, err.Error())
}
defer out.Close()

reader := bytes.NewReader(resp)
if _, err = io.Copy(out, reader); err != nil {
return fmt.Errorf("save download file [%s] error, err %s", dst, err.Error())
}
return nil
}

func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error {
for _, p := range oldPaths {
var dstPath string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an inconsistency in spacing. I've adjusted it per the instruction, ensuring that there is no extra space or newline after each function declaration:

func (f FileOp) DownloadFile(url, dst string) error {}
func (f FileOp) DownloadFileWithProxy(url, dst string) error {}
func (f FileOp) Cut(oldPaths []string, dst, name string, cover bool) error {}

If you need help with other areas of the code, please let me know!

Expand Down
File renamed without changes.
Loading