mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-09-29 19:01:30 +02:00
HTML output was broken when authors with quotes were sent to JavaScript.
Fixed by using json.dumps() to escape the author name before passing it to the JavaScript output.
This commit is contained in:
parent
98c375a0ab
commit
124ca74650
@ -29,6 +29,7 @@ import filtering
|
|||||||
import format
|
import format
|
||||||
import gravatar
|
import gravatar
|
||||||
import interval
|
import interval
|
||||||
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -246,7 +247,7 @@ class BlameOutput(Outputable):
|
|||||||
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
|
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
|
||||||
blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
|
blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
|
||||||
blame_xml += "</tr>"
|
blame_xml += "</tr>"
|
||||||
chart_data += "{{label: \"{0}\", data: {1}}}".format(entry[0], work_percentage)
|
chart_data += "{{label: {0}, data: {1}}}".format(json.dumps(entry[0]), work_percentage)
|
||||||
|
|
||||||
if blames[-1] != entry:
|
if blames[-1] != entry:
|
||||||
chart_data += ", "
|
chart_data += ", "
|
||||||
|
@ -28,6 +28,7 @@ import filtering
|
|||||||
import format
|
import format
|
||||||
import gravatar
|
import gravatar
|
||||||
import interval
|
import interval
|
||||||
|
import json
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import terminal
|
import terminal
|
||||||
@ -238,7 +239,7 @@ class ChangesOutput(Outputable):
|
|||||||
changes_xml += "<td>" + str(authorinfo.deletions) + "</td>"
|
changes_xml += "<td>" + str(authorinfo.deletions) + "</td>"
|
||||||
changes_xml += "<td>" + "{0:.2f}".format(percentage) + "</td>"
|
changes_xml += "<td>" + "{0:.2f}".format(percentage) + "</td>"
|
||||||
changes_xml += "</tr>"
|
changes_xml += "</tr>"
|
||||||
chart_data += "{{label: \"{0}\", data: {1}}}".format(entry, "{0:.2f}".format(percentage))
|
chart_data += "{{label: {0}, data: {1}}}".format(json.dumps(entry), "{0:.2f}".format(percentage))
|
||||||
|
|
||||||
if sorted(authorinfo_list)[-1] != entry:
|
if sorted(authorinfo_list)[-1] != entry:
|
||||||
chart_data += ", "
|
chart_data += ", "
|
||||||
|
Loading…
Reference in New Issue
Block a user