update: Possibility to change the authorized max line length in the config for the diff of duplicates

pull/164/head
Sami Mokaddem 2017-12-12 11:00:26 +01:00
parent 3fe7ecf75a
commit 304213cfa4
3 changed files with 8 additions and 4 deletions

View File

@ -21,15 +21,17 @@ sentiment_lexicon_file = sentiment/vader_lexicon.zip/vader_lexicon/vader_lexicon
##### Flask ##### ##### Flask #####
[Flask] [Flask]
#Maximum number of character to display in the toolip #Maximum number of character to display in the toolip
max_preview_char = 250 max_preview_char = 250
#Maximum number of character to display in the modal #Maximum number of character to display in the modal
max_preview_modal = 800 max_preview_modal = 800
#Default number of header to display in trending graphs #Default number of header to display in trending graphs
default_display = 10 default_display = 10
#Number of minutes displayed for the number of processed pastes. #Number of minutes displayed for the number of processed pastes.
minute_processed_paste = 10 minute_processed_paste = 10
#Maximum line length authorized to make a diff between duplicates
DiffMaxLineLength = 10000
#### Modules #### #### Modules ####
[Modules_Duplicates] [Modules_Duplicates]
#Number of month to look back #Number of month to look back
maximum_month_range = 3 maximum_month_range = 3

View File

@ -63,3 +63,4 @@ max_preview_char = int(cfg.get("Flask", "max_preview_char")) # Maximum number of
max_preview_modal = int(cfg.get("Flask", "max_preview_modal")) # Maximum number of character to display in the modal max_preview_modal = int(cfg.get("Flask", "max_preview_modal")) # Maximum number of character to display in the modal
tlsh_to_percent = 1000.0 #Use to display the estimated percentage instead of a raw value tlsh_to_percent = 1000.0 #Use to display the estimated percentage instead of a raw value
DiffMaxLineLength = int(cfg.get("Flask", "DiffMaxLineLength"))#Use to display the estimated percentage instead of a raw value

View File

@ -21,6 +21,7 @@ r_serv_pasteName = Flask_config.r_serv_pasteName
max_preview_char = Flask_config.max_preview_char max_preview_char = Flask_config.max_preview_char
max_preview_modal = Flask_config.max_preview_modal max_preview_modal = Flask_config.max_preview_modal
tlsh_to_percent = Flask_config.tlsh_to_percent tlsh_to_percent = Flask_config.tlsh_to_percent
DiffMaxLineLength = Flask_config.DiffMaxLineLength
showsavedpastes = Blueprint('showsavedpastes', __name__, template_folder='templates') showsavedpastes = Blueprint('showsavedpastes', __name__, template_folder='templates')
@ -122,7 +123,7 @@ def showDiff():
p2 = Paste.Paste(s2) p2 = Paste.Paste(s2)
maxLengthLine1 = p1.get_lines_info()[1] maxLengthLine1 = p1.get_lines_info()[1]
maxLengthLine2 = p2.get_lines_info()[1] maxLengthLine2 = p2.get_lines_info()[1]
if maxLengthLine1 > 100000 or maxLengthLine2 > 100000: if maxLengthLine1 > DiffMaxLineLength or maxLengthLine2 > DiffMaxLineLength:
return "Can't make the difference as the lines are too long." return "Can't make the difference as the lines are too long."
htmlD = difflib.HtmlDiff() htmlD = difflib.HtmlDiff()
lines1 = p1.get_p_content().decode('utf8', 'ignore').splitlines() lines1 = p1.get_p_content().decode('utf8', 'ignore').splitlines()