mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add more parameter validation.
This commit is contained in:
parent
322769b0e4
commit
a1170677b4
1 changed files with 5 additions and 2 deletions
|
@ -48,6 +48,9 @@ public class SearchHandlers {
|
|||
public static byte[] searchResponse(String q, String filter)
|
||||
throws IOException, ExtractionException {
|
||||
|
||||
if (StringUtils.isEmpty(q) || StringUtils.isEmpty(filter))
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query and filter are required parameters"));
|
||||
|
||||
Sentry.setExtra("query", q);
|
||||
|
||||
final SearchInfo info = SearchInfo.getInfo(YOUTUBE_SERVICE,
|
||||
|
@ -65,8 +68,8 @@ public class SearchHandlers {
|
|||
public static byte[] searchPageResponse(String q, String filter, String prevpageStr)
|
||||
throws IOException, ExtractionException {
|
||||
|
||||
if (StringUtils.isEmpty(prevpageStr))
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("nextpage is a required parameter"));
|
||||
if (StringUtils.isEmpty(q) || StringUtils.isEmpty(prevpageStr))
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query and nextpage are required parameter"));
|
||||
|
||||
Page prevpage = mapper.readValue(prevpageStr, Page.class);
|
||||
|
||||
|
|
Loading…
Reference in a new issue