Skip to content

fix(search): truncate search parameters for SQLite LIKE compatibility (#36) - #56

Open
Labreo wants to merge 1 commit into
cloudflare:mainfrom
Labreo:fix/sqlite-like-pattern-limit
Open

fix(search): truncate search parameters for SQLite LIKE compatibility (#36)#56
Labreo wants to merge 1 commit into
cloudflare:mainfrom
Labreo:fix/sqlite-like-pattern-limit

Conversation

@Labreo

@Labreo Labreo commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Truncates search parameters (query, from, to, subject) to 48 characters before constructing SQLite LIKE patterns (%...%).

Context

SQLite enforces a default pattern length limit of 50 bytes for LIKE clauses (SQLITE_MAX_LIKE_PATTERN_LENGTH = 50). Search parameters longer than 48 characters produced wildcard strings exceeding 50 bytes, causing uncaught SQLite pattern length limit exceptions and returning HTTP 500 errors inside Durable Objects (#36).

Solution

Truncate inputs to a maximum of 48 characters (MAX_LIKE_PARAM_LENGTH = 48) so surrounding % wildcards never exceed the 50-byte limit.

Fixes #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Potential PR: long search strings can 500 via Durable Object SQLite LIKE pattern limit

1 participant