mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Return error if query exceeds 255 char
This commit is contained in:
parent
3d599ad7ab
commit
83cd0ac880
4 changed files with 9 additions and 0 deletions
|
|
@ -2223,6 +2223,7 @@ export type SearchError = {
|
|||
};
|
||||
|
||||
export enum SearchErrorCode {
|
||||
QueryTooLong = 'QUERY_TOO_LONG',
|
||||
Unauthorized = 'UNAUTHORIZED'
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1623,6 +1623,7 @@ type SearchError {
|
|||
}
|
||||
|
||||
enum SearchErrorCode {
|
||||
QUERY_TOO_LONG
|
||||
UNAUTHORIZED
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import {
|
|||
SaveArticleReadingProgressErrorCode,
|
||||
SaveArticleReadingProgressSuccess,
|
||||
SearchError,
|
||||
SearchErrorCode,
|
||||
SearchItem,
|
||||
SearchSuccess,
|
||||
SetBookmarkArticleError,
|
||||
|
|
@ -873,6 +874,11 @@ export const searchResolver = authorized<
|
|||
const startCursor = params.after || ''
|
||||
const first = params.first || 10
|
||||
|
||||
// the query size is limited to 255 characters
|
||||
if (params.query && params.query.length > 255) {
|
||||
return { errorCodes: [SearchErrorCode.QueryTooLong] }
|
||||
}
|
||||
|
||||
const searchQuery = parseSearchQuery(params.query || undefined)
|
||||
|
||||
analytics.track({
|
||||
|
|
|
|||
|
|
@ -1587,6 +1587,7 @@ const schema = gql`
|
|||
|
||||
enum SearchErrorCode {
|
||||
UNAUTHORIZED
|
||||
QUERY_TOO_LONG
|
||||
}
|
||||
|
||||
type SearchError {
|
||||
|
|
|
|||
Loading…
Reference in a new issue