diff --git a/servefile b/servefile index 821e317..928ba23 100755 --- a/servefile +++ b/servefile @@ -349,6 +349,27 @@ class DirListingHandler(FileBaseHandler): htmlstr = htmlstr.replace(src, dst) return htmlstr + def _appendToListing(self, content, item, itemPath, stat, is_dir): + # Strings to display on directory listing + lastModifiedDate = datetime.datetime.fromtimestamp(stat.st_mtime) + lastModified = lastModifiedDate.strftime("%Y-%m-%d %H:%M") + fileSize = "%.1f%s" % self.convertSize(stat.st_size) + (fileType, _) = mimetypes.guess_type(itemPath) + if not fileType: + fileType = "-" + + if is_dir: + item += "/" + fileType = "Directory" + content.append(""" +