Skip to content

Commit

Permalink
Fixed body length bug in manually report (#47)
Browse files Browse the repository at this point in the history
* Fixed body length issue

* updated changelog and bump version
  • Loading branch information
M97Chahboun authored Feb 18, 2024
1 parent 1f377e6 commit d876b0a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@
* handled duplicated issues by add (+1) as comment on duplicated issues

## 0.0.16
* Fixed duplicated issues caused by pagination with using search api
* Fixed duplicated issues caused by pagination with using search api

## 0.0.17
* Fixed report manually issue (hotfix)
6 changes: 5 additions & 1 deletion lib/src/utils/github_snitch_instance.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:math' as math;
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:device_info_plus/device_info_plus.dart';

Expand Down Expand Up @@ -208,7 +209,10 @@ class GhSnitchInstance {
/// It takes the `body` as required parametes.
Future<bool> isAlreadyReported(String body) async {
bool isAlreadyReported = false;
body = body.replaceAll("```", "").substring(0, 255).replaceFirst("#", "");
body = body
.replaceAll("```", "")
.substring(0, math.min(body.length, 255))
.replaceFirst("#", "");
String url =
"https://api.github.com/search/issues?q=repo:$owner/$repo+is:issue+is:open+$body";
GhResponse ghResponse = await ghRequest.request("GET", url, isSearch: true);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: github_snitch
description: Package for capture & open github issue for crashes, issues & proposals
version: 0.0.16
version: 0.0.17
homepage: https://github.com/M97Chahboun/github_snitch

environment:
Expand Down

0 comments on commit d876b0a

Please sign in to comment.