-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fix/sanitize old data for usergroups.thumbnail #3498
🐛 Fix/sanitize old data for usergroups.thumbnail #3498
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3498 +/- ##
=========================================
- Coverage 83.4% 82.9% -0.5%
=========================================
Files 834 349 -485
Lines 35438 17823 -17615
Branches 748 133 -615
=========================================
- Hits 29572 14791 -14781
+ Misses 5676 2983 -2693
+ Partials 190 49 -141
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great! thanks
Merci 👌. Regarding the embedded image, I also saw it in prod AWS, I need to check if the frontend supports it. |
@odeimaiz Please let me know because with this change it will be disabled. An alternative would to accept any kind of string for the thumbnail which would allow embedded images. |
1532147
to
2bc9315
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
What do these changes do?
The
thumbnail
column in thegroups
table contains old data that does not validate as an url. I have found empty strings, or embedded images. From now on, any invalid thumbnail (i.e. a valud that does not matchOptional[AnyUrl]
) is automatically nullified.This error happens while
get_profile
: The database has an old thumbnail that when parsed intoProfileGet
aValidationError
is raised which is converted by the middle-ware into 500. SinceWEBSERVER_DIAGNOSTICS=
the error is logged in the backend:why?: The problem is that
groups
resources are NOT validated (handlers are pretty old) when created but theProfile
resource IS validated when read. That lead to a paradoxical situation in which you could write "invalid" group data but could not read it via theProfile
. We can take care of that after the review #3499@odeimaiz : I found entries with embedded images like
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPgAAADMCAMAAABp5J ...
. Do we really want to have embedded thumbnails or only URL? Does the front-end support both?How to test
services/web/server/tests/unit/isolated/test_groups_models.py::test_sanitize_legacy_data