Trim size of details in crash reports properly.
This commit is contained in:
parent
7fba20d113
commit
1eea12ff27
@ -13,7 +13,7 @@
|
|||||||
"changelog": "https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md",
|
"changelog": "https://github.com/ccd0/4chan-x/blob/master/CHANGELOG.md",
|
||||||
"issues": "https://gitreports.com/issue/ccd0/4chan-x",
|
"issues": "https://gitreports.com/issue/ccd0/4chan-x",
|
||||||
"newIssue": "https://gitreports.com/issue/ccd0/4chan-x?issue_title=%title&details=%details",
|
"newIssue": "https://gitreports.com/issue/ccd0/4chan-x?issue_title=%title&details=%details",
|
||||||
"newIssueMaxLength": 8200,
|
"newIssueMaxLength": 8181,
|
||||||
"appid": "lacclbnghgdicfifcamcmcnilckjamag",
|
"appid": "lacclbnghgdicfifcamcmcnilckjamag",
|
||||||
"chromeStoreID": "ohnjgmpcibpbafdlkimncjhflgedgpam",
|
"chromeStoreID": "ohnjgmpcibpbafdlkimncjhflgedgpam",
|
||||||
"recaptchaKey": "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc",
|
"recaptchaKey": "6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc",
|
||||||
|
|||||||
@ -372,21 +372,22 @@ Main =
|
|||||||
data = errors[0]
|
data = errors[0]
|
||||||
title = data.message
|
title = data.message
|
||||||
title += " (+#{errors.length - 1} other errors)" if errors.length > 1
|
title += " (+#{errors.length - 1} other errors)" if errors.length > 1
|
||||||
details = """
|
details = ''
|
||||||
|
addDetails = (text) ->
|
||||||
|
unless encodeURIComponent(title + details + text + '\n').length > <%= meta.newIssueMaxLength - meta.newIssue.replace(/%(title|details)/, '').length %>
|
||||||
|
details += text + '\n'
|
||||||
|
addDetails """
|
||||||
[Please describe the steps needed to reproduce this error.]
|
[Please describe the steps needed to reproduce this error.]
|
||||||
|
|
||||||
Script: <%= meta.name %> <%= meta.fork %> v#{g.VERSION} #{$.platform}
|
Script: <%= meta.name %> <%= meta.fork %> v#{g.VERSION} #{$.platform}
|
||||||
User agent: #{navigator.userAgent}
|
User agent: #{navigator.userAgent}
|
||||||
URL: #{location.href}
|
URL: #{location.href}
|
||||||
|
|
||||||
#{data.error}
|
|
||||||
#{data.error.stack?.replace(data.error.toString(), '').trim() or ''}
|
|
||||||
"""
|
"""
|
||||||
details += "\n\n#{data.html}" if data.html
|
addDetails '\n' + data.error
|
||||||
|
addDetails data.error.stack.replace(data.error.toString(), '').trim() if data.error.stack
|
||||||
|
addDetails '\n' + data.html if data.html
|
||||||
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
||||||
details = details.trim()
|
|
||||||
url = "<%= meta.newIssue.replace('%title', '#{encodeURIComponent title}').replace('%details', '#{encodeURIComponent details}') %>"
|
url = "<%= meta.newIssue.replace('%title', '#{encodeURIComponent title}').replace('%details', '#{encodeURIComponent details}') %>"
|
||||||
url = url[...<%= meta.newIssueMaxLength %>]
|
|
||||||
<%= html('<span class="report-error"> [<a href="${url}" target="_blank">report</a>]</span>') %>
|
<%= html('<span class="report-error"> [<a href="${url}" target="_blank">report</a>]</span>') %>
|
||||||
|
|
||||||
isThisPageLegit: ->
|
isThisPageLegit: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user