diff --git a/doc/configuration.rst b/doc/configuration.rst index 2f310d3..aa51002 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -1391,17 +1391,6 @@ validate new project name. Defaults to: ``^[a-zA-z0-9_][a-zA-Z0-9-_]*$`` -FILE_SIZE_HIGHLIGHT -~~~~~~~~~~~~~~~~~~~ - -This configuration key allows to specify the maximum number of characters a file -or diff should have to have syntax highlighting. Everything above this limit -will not have syntax highlighting as this is a memory intensive procedure that -easily leads to out of memory error on large files or diff. - -Defaults to: ``5000`` - - APPLICATION_ROOT ~~~~~~~~~~~~~~~~ @@ -1536,3 +1525,14 @@ must occupy subdirectories `docs`, `requests` and `tickets` under `GIT_FOLDER`. They are now computed automatically based on value of `GIT_FOLDER`. Usage of docs and tickets can be triggered by setting `ENABLE_DOCS` and `ENABLE_TICKETS` to `True` (this is the default). + + +FILE_SIZE_HIGHLIGHT +~~~~~~~~~~~~~~~~~~~ + +This configuration key allows to specify the maximum number of characters a file +or diff should have to have syntax highlighting. Everything above this limit +will not have syntax highlighting as this is a memory intensive procedure that +easily leads to out of memory error on large files or diff. + +Defaults to: ``5000`` diff --git a/files/pagure.cfg.sample b/files/pagure.cfg.sample index aadd631..2898966 100644 --- a/files/pagure.cfg.sample +++ b/files/pagure.cfg.sample @@ -15,9 +15,6 @@ ENABLE_DOCS = True # Enables / Disables private projects PRIVATE_PROJECTS = True -# File character limit before disabling syntax highlighting -FILE_SIZE_HIGHLIGHT = 500000 - ### Secret key for the Flask application SECRET_KEY='' diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index 7ca7ee2..cefe0e6 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -544,10 +544,7 @@ def view_file(repo, identifier, filename, username=None, namespace=None): elif ext in ('.rst', '.mk', '.md', '.markdown') and not rawtext: content, safe = pagure.doc_utils.convert_readme(content.data, ext) output_type = 'markup' - elif 'data' in dir(content) \ - and len(content.data) < pagure_config.get( - 'FILE_SIZE_HIGHLIGHT', 5000) \ - and not isbinary: + elif 'data' in dir(content) and not isbinary: file_content = None try: file_content = encoding_utils.decode(