Closed andychoi closed 1 year ago
Below looping logic is overwriting result["logs"] which is a bug. It ends up showing last sub-folder only.
def get_log_files(directory, max_items_per_page, current_page): result = {} for root, _, files in os.walk(directory): all_files = list(filter(lambda x: x.find("~") == -1, files)) all_log_files = [] all_log_files.extend( list(filter(lambda x: x in settings.LOG_VIEWER_FILES, all_files)) ) all_log_files.extend( [x for x in all_files if fnmatch(x, settings.LOG_VIEWER_FILES_PATTERN)] ) log_dir = os.path.relpath(root, directory) if log_dir == ".": log_dir = "" result["logs"] = {log_dir: list(set(all_log_files))} result["next_page_files"] = current_page + 1 result["last_files"] = ( all_log_files.__len__() <= current_page * max_items_per_page ) return result
Thank you for resolving this issue, it's now available in this version: https://github.com/agusmakmun/django-log-viewer/releases/tag/v1.1.7
Details
Steps to reproduce
Below looping logic is overwriting result["logs"] which is a bug. It ends up showing last sub-folder only.