mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2025-04-29 00:10:31 +05:30
Add check for query length.
This commit is contained in:
parent
20bff208d2
commit
cb598371b0
@ -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…
x
Reference in New Issue
Block a user