diff options
author | Aravinth Manivannan <realaravinth@batsense.net> | 2022-01-26 09:45:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-26 10:45:51 +0100 |
commit | 3bb028cc46401a8a54ecab7e7c035dbb24937b6c (patch) | |
tree | bff1aaaaa9d5eef6b9d1c520337e3cc51153b9e2 /modules/private/restore_repo.go | |
parent | 49dd9067535538771ef13623ed1dd9698a4a2151 (diff) | |
download | gitea-3bb028cc46401a8a54ecab7e7c035dbb24937b6c.tar.gz gitea-3bb028cc46401a8a54ecab7e7c035dbb24937b6c.zip |
Validate migration files (#18203)
JSON Schema validation for data used by Gitea during migrations
Discussion at https://forum.forgefriends.org/t/common-json-schema-for-repository-information/563
Co-authored-by: Loïc Dachary <loic@dachary.org>
Diffstat (limited to 'modules/private/restore_repo.go')
-rw-r--r-- | modules/private/restore_repo.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/modules/private/restore_repo.go b/modules/private/restore_repo.go index 6f8eaf927f..347ed5e78a 100644 --- a/modules/private/restore_repo.go +++ b/modules/private/restore_repo.go @@ -17,24 +17,26 @@ import ( // RestoreParams structure holds a data for restore repository type RestoreParams struct { - RepoDir string - OwnerName string - RepoName string - Units []string + RepoDir string + OwnerName string + RepoName string + Units []string + Validation bool } // RestoreRepo calls the internal RestoreRepo function -func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string) (int, string) { +func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string, validation bool) (int, string) { reqURL := setting.LocalURL + "api/internal/restore_repo" req := newInternalRequest(ctx, reqURL, "POST") req.SetTimeout(3*time.Second, 0) // since the request will spend much time, don't timeout req = req.Header("Content-Type", "application/json") jsonBytes, _ := json.Marshal(RestoreParams{ - RepoDir: repoDir, - OwnerName: ownerName, - RepoName: repoName, - Units: units, + RepoDir: repoDir, + OwnerName: ownerName, + RepoName: repoName, + Units: units, + Validation: validation, }) req.Body(jsonBytes) resp, err := req.Response() |