Skip to content

Commit

Permalink
fix: upload metadatas.json failure (#2065)
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail authored Nov 20, 2024
1 parent 232eecc commit 0bd17fe
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions builder/exector/import_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,6 @@ func (i *ImportApp) importApp() error {
i.updateStatusForApp(app, "failed")
return
}

files, _ := ioutil.ReadDir(tmpDir)
if len(files) < 1 {
logrus.Errorf("Failed to readDir %s: %v", appFile, err)
i.updateStatusForApp(app, "failed")
return
}
metadataJsonPath := path.Join(tmpDir, files[0].Name(), "metadata.json")
err = storage.Default().StorageCli.UploadFileToFile(metadataJsonPath, metadataJsonPath, nil)
if err != nil {
logrus.Errorf("Failed to upload app %s metadatas.json: %v", appFile, err)
i.updateStatusForApp(app, "failed")
return
}
os.Rename(appFile, appFile+".success")
datas = append(datas, *ram)
logrus.Infof("Successful import app: %s", appFile)
Expand All @@ -179,6 +165,11 @@ func (i *ImportApp) importApp() error {
logrus.Errorf("Failed to load apps %s: %v", i.SourceDir, err)
return err
}
err := storage.Default().StorageCli.UploadFileToFile(metadatasFile, metadatasFile, nil)
if err != nil {
logrus.Errorf("Failed to upload app %s metadatas.json: %v", appFile, err)
return err
}
return nil
}

Expand Down

0 comments on commit 0bd17fe

Please sign in to comment.