feat: made arch param optional when adding Git repo

This commit is contained in:
Jef Roosens 2022-05-01 12:44:54 +02:00
parent d9d7272b44
commit b1ac39e234
Signed by untrusted user: Jef Roosens
GPG key ID: B75D4F293C7052DB
3 changed files with 20 additions and 8 deletions

View file

@ -57,7 +57,15 @@ fn (mut app App) post_repo() web.Result {
return app.json(http.Status.unauthorized, new_response('Unauthorized.'))
}
new_repo := git.repo_from_params(app.query) or {
mut params := app.query.clone()
// If a repo is created without specifying the arch, we assume it's meant
// for the default architecture.
if 'arch' !in params {
params['arch'] = app.conf.default_arch
}
new_repo := git.repo_from_params(params) or {
return app.json(http.Status.bad_request, new_response(err.msg()))
}