mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	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:
		| @@ -12,6 +12,7 @@ import ( | ||||
| 	"net/url" | ||||
| 	"os" | ||||
| 	"path/filepath" | ||||
| 	"strconv" | ||||
| 	"time" | ||||
|  | ||||
| 	"code.gitea.io/gitea/models" | ||||
| @@ -19,6 +20,7 @@ import ( | ||||
| 	"code.gitea.io/gitea/modules/log" | ||||
| 	"code.gitea.io/gitea/modules/migrations/base" | ||||
| 	"code.gitea.io/gitea/modules/repository" | ||||
| 	"code.gitea.io/gitea/modules/structs" | ||||
|  | ||||
| 	"gopkg.in/yaml.v2" | ||||
| ) | ||||
| @@ -572,20 +574,27 @@ func RestoreRepository(ctx context.Context, baseDir string, ownerName, repoName | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	opts, err := downloader.getRepoOptions() | ||||
| 	if err != nil { | ||||
| 		return err | ||||
| 	} | ||||
| 	tp, _ := strconv.Atoi(opts["service_type"]) | ||||
|  | ||||
| 	if err = migrateRepository(downloader, uploader, base.MigrateOptions{ | ||||
| 		Wiki:          true, | ||||
| 		Issues:        true, | ||||
| 		Milestones:    true, | ||||
| 		Labels:        true, | ||||
| 		Releases:      true, | ||||
| 		Comments:      true, | ||||
| 		PullRequests:  true, | ||||
| 		ReleaseAssets: true, | ||||
| 		Wiki:           true, | ||||
| 		Issues:         true, | ||||
| 		Milestones:     true, | ||||
| 		Labels:         true, | ||||
| 		Releases:       true, | ||||
| 		Comments:       true, | ||||
| 		PullRequests:   true, | ||||
| 		ReleaseAssets:  true, | ||||
| 		GitServiceType: structs.GitServiceType(tp), | ||||
| 	}); err != nil { | ||||
| 		if err1 := uploader.Rollback(); err1 != nil { | ||||
| 			log.Error("rollback failed: %v", err1) | ||||
| 		} | ||||
| 		return err | ||||
| 	} | ||||
| 	return nil | ||||
| 	return updateMigrationPosterIDByGitService(ctx, structs.GitServiceType(tp)) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lunny Xiao
					Lunny Xiao