djcev.com

//

Git Repos / blogofile_gitview / commit ce7d7c3

Commit: ce7d7c3e371bfb3f799ea5e08a4a6cf0b858fafb
Parent: 1bb94a6d344b06fd4946cf69cec95735d491d67a
Author: Cameron Vanderzanden, 2021-07-25 14:19
Committer: Cameron Vanderzanden, 2021-07-25 14:19

Commit Message

Files that start with a '.' might cause problems. Fix?

Change List

Diff _controllers/gitview.py

diff --git a/_controllers/gitview.py b/_controllers/gitview.py
index d53e041..94289fc 100644
--- a/_controllers/gitview.py
+++ b/_controllers/gitview.py
@@ -207,6 +207,8 @@ def write_obj(fl, repo, repoinfo, tree, path):
if obj.is_binary:
isimage, data = write_obj_binary(repoinfo, obj, path)
else: data = write_obj_text(repoinfo, obj, path)
+ if obj.name.startswith('.'): safename = 'dot{}'.format(obj.name[1:])
+ else: safename = obj.name
f = {
"fullname": bf.util.path_join(path, obj.name),
"id": obj.id,
@@ -215,10 +217,11 @@ def write_obj(fl, repo, repoinfo, tree, path):
"mode": stat.filemode(obj.filemode),
"name": obj.name,
"objsize": objsize,
+ "sfname": bf.util.path_join(path, safename),
"type": obj.type_str
}
tools.materialize_template("git_file.mako", bf.util.path_join(
- config.path, repoinfo['name'], config.objdir, path, obj.name +
+ config.path, repoinfo['name'], config.objdir, path, safename +
".html"),
{"file": f, "data": data, "repo": repoinfo} )
fl.append(f)

Return to the top of this page or return to the overview of this repo.

Diff _templates/gitview/git_file_list.mako

diff --git a/_templates/gitview/git_file_list.mako b/_templates/gitview/git_file_list.mako
index 6aafd95..f898c68 100644
--- a/_templates/gitview/git_file_list.mako
+++ b/_templates/gitview/git_file_list.mako
@@ -15,7 +15,7 @@
% for f in files:
<tr><td class="filemode">${f['mode']}</td>
<td class="filename">
-<a href="${objdir}/${f['fullname']}.html">${trunc_fname(f['fullname'])}</a></td>
+<a href="${objdir}/${f['sfname']}.html">${trunc_fname(f['fullname'])}</a></td>
<td class="filesize">${f['objsize']}</td></tr>
% endfor
</table>

Return to the top of this page or return to the overview of this repo.