mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
add length check to github issue url (#3485)
This commit is contained in:
parent
6a93624040
commit
ce6ab31c32
@ -16,6 +16,8 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class ExceptionDialog
|
public partial class ExceptionDialog
|
||||||
{
|
{
|
||||||
|
const int MAX_GITHUB_URL_LENGTH = 8192;
|
||||||
|
|
||||||
public ExceptionDialog(Exception exception)
|
public ExceptionDialog(Exception exception)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -27,12 +29,19 @@ namespace Bloxstrap.UI.Elements.Dialogs
|
|||||||
string repoUrl = $"https://github.com/{App.ProjectRepository}";
|
string repoUrl = $"https://github.com/{App.ProjectRepository}";
|
||||||
string wikiUrl = $"{repoUrl}/wiki";
|
string wikiUrl = $"{repoUrl}/wiki";
|
||||||
|
|
||||||
string issueUrl = String.Format(
|
string title = HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}");
|
||||||
"{0}/issues/new?template=bug_report.yaml&title={1}&log={2}",
|
string log = HttpUtility.UrlEncode(String.Join('\n', App.Logger.History));
|
||||||
repoUrl,
|
|
||||||
HttpUtility.UrlEncode($"[BUG] {exception.GetType()}: {exception.Message}"),
|
string issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}&log={log}";
|
||||||
HttpUtility.UrlEncode(String.Join('\n', App.Logger.History))
|
|
||||||
);
|
if (issueUrl.Length > MAX_GITHUB_URL_LENGTH)
|
||||||
|
{
|
||||||
|
// url is way too long for github. remove the log parameter.
|
||||||
|
issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml&title={title}";
|
||||||
|
|
||||||
|
if (issueUrl.Length > MAX_GITHUB_URL_LENGTH)
|
||||||
|
issueUrl = $"{repoUrl}/issues/new?template=bug_report.yaml"; // bruh
|
||||||
|
}
|
||||||
|
|
||||||
string helpMessage = String.Format(Strings.Dialog_Exception_Info_2, wikiUrl, issueUrl);
|
string helpMessage = String.Format(Strings.Dialog_Exception_Info_2, wikiUrl, issueUrl);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user