Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extension: Fix formatting of bug reports #2343

Merged
merged 2 commits into from
May 23, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions lighthouse-extension/app/src/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,21 @@ function hideRunningSubpage() {
}

function buildReportErrorLink(err) {
let qsBody = '**Lighthouse Version**: ' + getLighthouseVersion() + '\n';
qsBody += '**Chrome Version**: ' + getChromeVersion() + '\n';

if (siteURL) {
qsBody += '**URL**: ' + siteURL + '\n';
}

qsBody += '**Error Message**: ' + err.message + '\n';
qsBody += '**Stack Trace**:\n ```' + err.stack + '```';
const issueBody = `
**Lighthouse Version**: ${getLighthouseVersion()}
**Chrome Version**: ${getChromeVersion()}
**Initial URL**: ${siteURL}
**Error Message**: ${err.message}
**Stack Trace**:
\`\`\`
${err.stack}
\`\`\`
`;

const base = 'https://github.com/GoogleChrome/lighthouse/issues/new?';
let titleError = err.message;

if (titleError.length > MAX_ISSUE_ERROR_LENGTH) {
titleError = `${titleError.substring(0, MAX_ISSUE_ERROR_LENGTH - 3)}...`;
}
const title = encodeURI('title=Extension Error: ' + titleError);
const body = '&body=' + encodeURI(qsBody);
const errorTitle = err.message.substring(0, MAX_ISSUE_ERROR_LENGTH);
const title = encodeURI('title=Extension Error: ' + errorTitle);
const body = '&body=' + encodeURI(issueBody.trim());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this also needs encodeURIComponent


const reportErrorEl = document.createElement('a');
reportErrorEl.className = 'button button--report-error';
Expand Down