fix: write per-locale values from siblingData when req.locale is 'all' for localized fields#16771
Open
deepshekhardas wants to merge 5 commits into
Open
Conversation
The connectWithReconnect function calls pool.connect() to check out a client but never calls result.release() to return it to the pool. This permanently holds one connection from the pool, causing pool exhaustion when multiple concurrent queries are running. This fix adds result.release() after setting up the error listener to properly return the connection to the pool. Fixes: payloadcms#16256 (connection leak part)
…ectWithReconnect fix(db-postgres): fix connection leak in connectWithReconnect
The SAFE_STRING_REGEX was using \w which only matches ASCII characters,
blocking any non-ASCII characters (CJK, accented Latin, emoji, etc.) in
JSON field queries.
Changed to use \p{L} (Unicode letter) and \p{N} (Unicode number) with
the /u flag, which allows international text while still blocking SQL
metacharacters (' , ; -- ( ) = / \ etc.).
Fixes: payloadcms#16401
fix(drizzle): allow unicode characters in JSON query values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When
eq.locale\ is set to 'all', localized fields were not correctly writing per-locale values from \siblingData. This caused the wrong locale values to be persisted when operating in 'all'\ locale mode.
Root Cause
In the \�eforeChange\ hook for fields, when
eq.locale === 'all', the code was reading from \data\ instead of \siblingData\ for per-locale field values. \siblingData\ contains the correct per-locale values that should be written.
Fix
Added a check: when
eq.locale === 'all', read the field value from \siblingData[fieldName]\ instead of falling through to the default \data[fieldName]\ path.
Type of change