forked from vieter-v/vieter
Bumped v release; files are now served properly
This commit is contained in:
parent
3c0b7156c1
commit
8a0beffbe2
5 changed files with 11 additions and 10 deletions
10
src/routes.v
10
src/routes.v
|
|
@ -27,7 +27,7 @@ fn is_pkg_name(s string) bool {
|
|||
|
||||
['/health'; get]
|
||||
pub fn (mut app App) healthcheck() web.Result {
|
||||
return app.text('Healthy')
|
||||
return app.text('Healthy')
|
||||
}
|
||||
|
||||
// get_root handles a GET request for a file on the root
|
||||
|
|
@ -35,10 +35,12 @@ pub fn (mut app App) healthcheck() web.Result {
|
|||
fn (mut app App) get_root(filename string) web.Result {
|
||||
mut full_path := ''
|
||||
|
||||
if is_pkg_name(filename) {
|
||||
full_path = os.join_path_single(app.repo.pkg_dir, filename)
|
||||
if filename.ends_with('.db') || filename.ends_with('.files') {
|
||||
full_path = os.join_path_single(app.repo.repo_dir, '${filename}.tar.gz')
|
||||
} else if filename.ends_with('.db.tar.gz') || filename.ends_with('.files.tar.gz') {
|
||||
full_path = os.join_path_single(app.repo.repo_dir, '$filename')
|
||||
} else {
|
||||
full_path = os.join_path_single(app.repo.repo_dir, filename)
|
||||
full_path = os.join_path_single(app.repo.pkg_dir, filename)
|
||||
}
|
||||
|
||||
return app.file(full_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue