mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add check for query length.
This commit is contained in:
parent
20bff208d2
commit
cb598371b0
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,9 @@ public class SearchHandlers {
|
|||
if (StringUtils.isEmpty(query))
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query is a required parameter"));
|
||||
|
||||
if (query.length() > 100)
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query is too long"));
|
||||
|
||||
return mapper.writeValueAsBytes(YOUTUBE_SERVICE.getSuggestionExtractor().suggestionList(query));
|
||||
|
||||
}
|
||||
|
@ -38,6 +41,9 @@ public class SearchHandlers {
|
|||
if (StringUtils.isEmpty(query))
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query is a required parameter"));
|
||||
|
||||
if (query.length() > 100)
|
||||
ExceptionHandler.throwErrorResponse(new InvalidRequestResponse("query is too long"));
|
||||
|
||||
return mapper.writeValueAsBytes(Arrays.asList(
|
||||
query,
|
||||
YOUTUBE_SERVICE.getSuggestionExtractor().suggestionList(query)
|
||||
|
|
Loading…
Reference in a new issue