mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 06:43:42 +00:00
fix: handle empty string params (#620)
This commit is contained in:
7 files changed
+26
-9
No files matched your search
@@ -5,6 +5,8 @@
|
|||||||
[](https://docs.gopeed.com/donate.html)
|
[](https://docs.gopeed.com/donate.html)
|
||||||
[](https://discord.gg/ZUJqJrwCGB)
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|
<a href="https://trendshift.io/repositories/7953" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7953" alt="GopeedLab%2Fgopeed | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://ko-fi.com/R6R6IJGN6)
|
[](https://ko-fi.com/R6R6IJGN6)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[](https://docs.gopeed.com/donate.html)
|
[](https://docs.gopeed.com/donate.html)
|
||||||
[](https://discord.gg/ZUJqJrwCGB)
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|
<a href="https://trendshift.io/repositories/7953" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7953" alt="GopeedLab%2Fgopeed | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://ko-fi.com/R6R6IJGN6)
|
[](https://ko-fi.com/R6R6IJGN6)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[](https://docs.gopeed.com/donate.html)
|
[](https://docs.gopeed.com/donate.html)
|
||||||
[](https://discord.gg/ZUJqJrwCGB)
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|
<a href="https://trendshift.io/repositories/7953" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7953" alt="GopeedLab%2Fgopeed | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://ko-fi.com/R6R6IJGN6)
|
[](https://ko-fi.com/R6R6IJGN6)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[](https://docs.gopeed.com/zh/donate.html)
|
[](https://docs.gopeed.com/zh/donate.html)
|
||||||
[](https://discord.gg/ZUJqJrwCGB)
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|
<a href="https://trendshift.io/repositories/7953" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7953" alt="GopeedLab%2Fgopeed | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://ko-fi.com/R6R6IJGN6)
|
[](https://ko-fi.com/R6R6IJGN6)
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
[](https://docs.gopeed.com/donate.html)
|
[](https://docs.gopeed.com/donate.html)
|
||||||
[](https://discord.gg/ZUJqJrwCGB)
|
[](https://discord.gg/ZUJqJrwCGB)
|
||||||
|
|
||||||
|
<a href="https://trendshift.io/repositories/7953" target="_blank"><img src="https://trendshift.io/api/badge/repositories/7953" alt="GopeedLab%2Fgopeed | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[](https://ko-fi.com/R6R6IJGN6)
|
[](https://ko-fi.com/R6R6IJGN6)
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ func (f *Fetcher) buildRequest(ctx context.Context, req *base.Request) (httpReq
|
|||||||
body = bytes.NewBufferString(extra.Body)
|
body = bytes.NewBufferString(extra.Body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if _, ok := headers[base.HttpHeaderUserAgent]; !ok {
|
if v := headers[base.HttpHeaderUserAgent]; len(v) == 0 || v[0] == "" {
|
||||||
// load user agent from config
|
// load user agent from config
|
||||||
headers[base.HttpHeaderUserAgent] = []string{f.config.UserAgent}
|
headers[base.HttpHeaderUserAgent] = []string{f.config.UserAgent}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ class CreateView extends GetView<CreateController> {
|
|||||||
Util.isWeb() && controller.fileDataUri.isNotEmpty;
|
Util.isWeb() && controller.fileDataUri.isNotEmpty;
|
||||||
final submitUrl = isWebFileChosen
|
final submitUrl = isWebFileChosen
|
||||||
? controller.fileDataUri.value
|
? controller.fileDataUri.value
|
||||||
: _urlController.text;
|
: _urlController.text.trim();
|
||||||
|
|
||||||
final urls = Util.textToLines(submitUrl);
|
final urls = Util.textToLines(submitUrl);
|
||||||
// Add url to the history
|
// Add url to the history
|
||||||
@@ -443,17 +443,24 @@ class CreateView extends GetView<CreateController> {
|
|||||||
Object? parseReqExtra(String url) {
|
Object? parseReqExtra(String url) {
|
||||||
Object? reqExtra;
|
Object? reqExtra;
|
||||||
if (controller.showAdvanced.value) {
|
if (controller.showAdvanced.value) {
|
||||||
final u = Uri.parse(_urlController.text);
|
switch (controller.advancedTabController.index) {
|
||||||
if (u.scheme.startsWith("http")) {
|
case 0:
|
||||||
reqExtra = ReqExtraHttp()
|
final header = {
|
||||||
..header = {
|
|
||||||
"User-Agent": _httpUaController.text,
|
"User-Agent": _httpUaController.text,
|
||||||
"Cookie": _httpCookieController.text,
|
"Cookie": _httpCookieController.text,
|
||||||
"Referer": _httpRefererController.text,
|
"Referer": _httpRefererController.text,
|
||||||
};
|
};
|
||||||
} else {
|
header.removeWhere((key, value) => value.trim().isEmpty);
|
||||||
reqExtra = ReqExtraBt()
|
if (header.isNotEmpty) {
|
||||||
..trackers = Util.textToLines(_btTrackerController.text);
|
reqExtra = ReqExtraHttp()..header = header;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (_btTrackerController.text.trim().isNotEmpty) {
|
||||||
|
reqExtra = ReqExtraBt()
|
||||||
|
..trackers = Util.textToLines(_btTrackerController.text);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return reqExtra;
|
return reqExtra;
|
||||||
|
|||||||
Reference in new issue
Block a user