Fix repo-restore bug with poster not replaced (#14759)

* Fix restore bug

* Fix restore bug

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
Lunny Xiao 2021-02-22 11:57:41 +08:00 committed by GitHub
parent cd8b2f3273
commit e79dae29cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 11 deletions

View file

@ -53,8 +53,7 @@ func (r *RepositoryRestorer) SetContext(ctx context.Context) {
r.ctx = ctx
}
// GetRepoInfo returns a repository information
func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error) {
func (r *RepositoryRestorer) getRepoOptions() (map[string]string, error) {
p := filepath.Join(r.baseDir, "repo.yml")
bs, err := ioutil.ReadFile(p)
if err != nil {
@ -66,6 +65,15 @@ func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error) {
if err != nil {
return nil, err
}
return opts, nil
}
// GetRepoInfo returns a repository information
func (r *RepositoryRestorer) GetRepoInfo() (*base.Repository, error) {
opts, err := r.getRepoOptions()
if err != nil {
return nil, err
}
isPrivate, _ := strconv.ParseBool(opts["is_private"])