fix: compile with selected V version
This commit is contained in:
parent
4dc82515f4
commit
455f3b5f41
5 changed files with 14 additions and 14 deletions
|
|
@ -19,15 +19,15 @@ pub fn (mut app App) healthcheck() web.Result {
|
|||
// repository's archives, but also package archives or the contents of a
|
||||
// package's desc file.
|
||||
['/:repo/:arch/:filename'; get; head; markused]
|
||||
fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Result {
|
||||
fn (mut app App) get_repo_file(repo_ string, arch string, filename string) web.Result {
|
||||
mut full_path := ''
|
||||
|
||||
db_exts := ['.db', '.files', '.db.tar.gz', '.files.tar.gz']
|
||||
|
||||
// There's no point in having the ability to serve db archives with wrong
|
||||
// filenames
|
||||
if db_exts.any(filename == '${repo}${it}') {
|
||||
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename)
|
||||
if db_exts.any(filename == '${repo_}${it}') {
|
||||
full_path = os.join_path(app.repo.repos_dir, repo_, arch, filename)
|
||||
|
||||
// repo-add does this using symlinks, but we just change the requested
|
||||
// path
|
||||
|
|
@ -35,13 +35,13 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
|
|||
full_path += '.tar.gz'
|
||||
}
|
||||
} else if filename.contains('.pkg') {
|
||||
full_path = os.join_path(app.repo.pkg_dir, repo, arch, filename)
|
||||
full_path = os.join_path(app.repo.pkg_dir, repo_, arch, filename)
|
||||
}
|
||||
// Default behavior is to return the desc file for the package, if present.
|
||||
// This can then also be used by the build system to properly check whether
|
||||
// a package is present in an arch-repo.
|
||||
else {
|
||||
full_path = os.join_path(app.repo.repos_dir, repo, arch, filename, 'desc')
|
||||
full_path = os.join_path(app.repo.repos_dir, repo_, arch, filename, 'desc')
|
||||
}
|
||||
|
||||
return app.file(full_path)
|
||||
|
|
@ -49,10 +49,10 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
|
|||
|
||||
// put_package handles publishing a package to a repository.
|
||||
['/:repo/publish'; auth; markused; post]
|
||||
fn (mut app App) put_package(repo string) web.Result {
|
||||
fn (mut app App) put_package(repo_ string) web.Result {
|
||||
// api is a reserved keyword for api routes & should never be allowed to be
|
||||
// a repository.
|
||||
if repo.to_lower() == 'api' {
|
||||
if repo_.to_lower() == 'api' {
|
||||
return app.json(.bad_request, new_response("'api' is a reserved keyword & cannot be used as a repository name."))
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ fn (mut app App) put_package(repo string) web.Result {
|
|||
return app.status(.length_required)
|
||||
}
|
||||
|
||||
res := app.repo.add_pkg_from_path(repo, pkg_path) or {
|
||||
res := app.repo.add_pkg_from_path(repo_, pkg_path) or {
|
||||
app.lerror('Error while adding package: ${err.msg()}')
|
||||
|
||||
os.rm(pkg_path) or { app.lerror("Failed to remove download '${pkg_path}': ${err.msg()}") }
|
||||
|
|
@ -90,7 +90,7 @@ fn (mut app App) put_package(repo string) web.Result {
|
|||
return app.status(.internal_server_error)
|
||||
}
|
||||
|
||||
app.linfo("Added '${res.name}-${res.version}' to '${repo} (${res.archs.join(',')})'.")
|
||||
app.linfo("Added '${res.name}-${res.version}' to '${repo_} (${res.archs.join(',')})'.")
|
||||
|
||||
return app.json(.ok, new_data_response(res))
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue