Unverified Commit 85ad6998 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Remove URL shortening from GitHub reporter similar issues URL (#53882)

parent b336452c
......@@ -165,7 +165,7 @@ Future<void> _informUserOfCrash(List<String> args, dynamic error, StackTrace sta
flutterProjectFactory: globals.projectFactory,
client: clientFactory != null ? clientFactory() : HttpClient(),
);
final String similarIssuesURL = await gitHubTemplateCreator.toolCrashSimilarIssuesGitHubURL(errorString);
final String similarIssuesURL = GitHubTemplateCreator.toolCrashSimilarIssuesURL(errorString);
globals.printStatus('$similarIssuesURL\n', wrap: false);
globals.printStatus('To report your crash to the Flutter team, first read the guide to filing a bug.', emphasis: true);
globals.printStatus('https://flutter.dev/docs/resources/bug-reports\n', wrap: false);
......
......@@ -32,9 +32,8 @@ class GitHubTemplateCreator {
final FlutterProjectFactory _flutterProjectFactory;
final HttpClient _client;
Future<String> toolCrashSimilarIssuesGitHubURL(String errorString) async {
final String fullURL = 'https://github.com/flutter/flutter/issues?q=is%3Aissue+${Uri.encodeQueryComponent(errorString)}';
return await _shortURL(fullURL);
static String toolCrashSimilarIssuesURL(String errorString) {
return 'https://github.com/flutter/flutter/issues?q=is%3Aissue+${Uri.encodeQueryComponent(errorString)}';
}
/// GitHub URL to present to the user containing encoded suggested template.
......
......@@ -24,31 +24,11 @@ void main() {
});
group('GitHub template creator', () {
testWithoutContext('similar issues URL', () async {
final GitHubTemplateCreator creator = GitHubTemplateCreator(
fileSystem: fs,
logger: logger,
client: SuccessShortenURLFakeHttpClient(),
flutterProjectFactory: FlutterProjectFactory(),
);
expect(
await creator.toolCrashSimilarIssuesGitHubURL('this is a 100% error'),
_kShortURL
);
});
testWithoutContext('similar issues URL with network failure', () async {
final GitHubTemplateCreator creator = GitHubTemplateCreator(
fileSystem: fs,
logger: logger,
client: FakeHttpClient(),
flutterProjectFactory: FlutterProjectFactory(),
);
testWithoutContext('similar issues URL', () {
expect(
await creator.toolCrashSimilarIssuesGitHubURL('this is a 100% error'),
'https://github.com/flutter/flutter/issues?q=is%3Aissue+this+is+a+100%25+error'
GitHubTemplateCreator.toolCrashSimilarIssuesURL('this is a 100% error'),
'https://github.com/flutter/flutter/issues?q=is%3Aissue+this+is+a+100%25+error',
);
expect(logger.traceText, contains('Failed to shorten GitHub template URL'));
});
group('new issue template URL', () {
......
......@@ -81,9 +81,6 @@ void main() {
});
testUsingContext('GitHub issue template', () async {
const String similarURL = 'https://example.com/1';
when(mockGitHubTemplateCreator.toolCrashSimilarIssuesGitHubURL(any))
.thenAnswer((_) async => similarURL);
const String templateURL = 'https://example.com/2';
when(mockGitHubTemplateCreator.toolCrashIssueTemplateGitHubURL(any, any, any, any, any))
.thenAnswer((_) async => templateURL);
......@@ -115,7 +112,7 @@ void main() {
expect(errorText, contains('Oops; flutter has exited unexpectedly: "an exception % --".\n'));
final String statusText = testLogger.statusText;
expect(statusText, contains(similarURL));
expect(statusText, contains('https://github.com/flutter/flutter/issues?q=is%3Aissue+an+exception+%25+--'));
expect(statusText, contains('https://flutter.dev/docs/resources/bug-reports'));
expect(statusText, contains(templateURL));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment