display a file when the folder contains only one file

This commit is contained in:
tdurieux
2017-10-27 10:15:03 +02:00
parent 433b881ac7
commit 3233266dd2

View File

@@ -312,6 +312,8 @@ class Anonymous_Github:
if f.path.lower() == "readme.md" or f.path.lower() == "index.html":
current_file = get_element_from_path(g_repo, os.path.join(path, f.path))
break
if len(files.tree) == 1:
current_file = get_element_from_path(g_repo, os.path.join(path, files.tree[0].path))
return files, current_file
@application.route('/repository/<id>', methods=['GET'], defaults={'path': ''})