Repository navigation
Feat prefs improvement - #2486
Conversation
There was a problem hiding this comment.
I think the root of this problem is the size of this field in app/config/collections.php and can't be solved in the route:
- By the time the request gets through middleware,
$prefsis already an assoc array, not JSON string, so I don't exactly know how/whystrlen()even works here 🤔 - By setting this field to
16384, we're actually creating a MEDIUMTEXT field (max 64Kb) when we actually want a TEXT field for this limit: https://github.com/utopia-php/database/blob/main/src/Database/Adapter/MariaDB.php#L989-L991 - In theory, the database should throw an exception regardless of what we do in the code at this point, if the field is actually TEXT.
edit: this may be solved as simply as changing the length of this field in app/config/collections.php to 16384 - 1 = 16383
| /** @var Utopia\Database\Database $dbForInternal */ | ||
| /** @var Appwrite\Stats\Stats $usage */ | ||
|
|
||
| if(\strlen($prefs) > 16384) { |
There was a problem hiding this comment.
This limit should be a part of a validator for better consistency. We also discussed mentioning the size limit as part of the param description. I think the extension can be located at src/Appwrite/Auth/Validator/Prefs unless someone has a better idea.
Note: when adding a new param we need to make sure it is translated to the proper format for the Swagger / OpenAPI exports.
|
To get tests to pass, we need this merged and released: #2486 I could not use the repositories trick, some other libraries did not like the version as branch number instead of a number. |
What does this PR do?
The maximum allowed size is
65535, which is 64kB.Opened question
Test Plan
Added new test
Related PRs and Issues
utopia-php/http#40
Have you read the Contributing Guidelines on issues?
✅