"Error while updating user" when not all profile fields are filled in #100

Closed
opened 2020-02-10 02:41:11 +01:00 by sth · 6 comments
sth commented 2020-02-10 02:41:11 +01:00 (Migrated from github.com)

Describe the issue
When I, for example, try to update the password of the predefined admin user, I get a "Error while updating user". The network console shows that the API request returns "400 Bad request"
with this response: ["email must be a string (maximum 512 characters)"]

The request contained "email":null, probably because the email field contains no text.

To Reproduce
Try to change the password of the predefined "admin" account.

Expected behavior
Update the user.

System (please complete the following information):
Debian buster, Firefox and Chrome, Glewlwyd 2.1.1 (Binary .deb packages from Github release)

Other notes
I do not have this problem when running the babelouest/glewlwyd docker image. There the empty field results in an empty string in the API request, not a null.

**Describe the issue** When I, for example, try to update the password of the predefined admin user, I get a "Error while updating user". The network console shows that the API request returns "400 Bad request" with this response: `["email must be a string (maximum 512 characters)"]` The request contained `"email":null`, probably because the email field contains no text. **To Reproduce** Try to change the password of the predefined "admin" account. **Expected behavior** Update the user. **System (please complete the following information):** Debian buster, Firefox and Chrome, Glewlwyd 2.1.1 (Binary .deb packages from Github release) **Other notes** I do *not* have this problem when running the `babelouest/glewlwyd` docker image. There the empty field results in an empty string in the API request, not a `null`.
sth commented 2020-02-10 03:06:25 +01:00 (Migrated from github.com)

The email is already null in the data sent by the server for /api/user?offset=0&limit=20. In the docker instance the server sends an empty string. So the problem seems to be server side. I use the Postgresql database backend, which is not the default, so maybe that is connected?

In the database itself there are empty strings, not null values, in the g_user table. I assume that's correct.

The `email` is already `null` in the data sent by the server for `/api/user?offset=0&limit=20`. In the docker instance the server sends an empty string. So the problem seems to be server side. I use the **Postgresql** database backend, which is not the default, so maybe that is connected? In the database itself there are empty strings, not `null` values, in the `g_user` table. I assume that's correct.
babelouest commented 2020-02-10 19:08:12 +01:00 (Migrated from github.com)

Hello @sth ,

Thanks for the issue!

In fact, the problem lies in Hoel library, more precisely here.

The line 317 should simply say:

if (val == NULL) {

I'll make the change in Hoel and release a new version, then the next hoel version will be shipped in Glewlwyd 2.1.1 or 2.2.0 when it'll be released (soon but not this week).
If you need the fix soon I suggest you install Hoel 1.4.14 when it'll be available.

Hello @sth , Thanks for the issue! In fact, the problem lies in [Hoel](https://github.com/babelouest/hoel/) library, more precisely [here](https://github.com/babelouest/hoel/blob/master/src/hoel-pgsql.c#L317). The line 317 should simply say: ```C if (val == NULL) { ``` I'll make the change in Hoel and release a new version, then the next hoel version will be shipped in Glewlwyd 2.1.1 or 2.2.0 when it'll be released (soon but not this week). If you need the fix soon I suggest you install [Hoel 1.4.14](https://github.com/babelouest/hoel/releases/latest) when it'll be available.
babelouest commented 2020-02-10 22:10:36 +01:00 (Migrated from github.com)

Nope, my bad, the fix isn't that simple because it breaks other parts of the application. I'm working on a real fix then.

Nope, my bad, the fix isn't that simple because it breaks other parts of the application. I'm working on a real fix then.
babelouest commented 2020-02-11 06:35:43 +01:00 (Migrated from github.com)

@sth so now I think I have the bug fixed for real in github.com/babelouest/hoel@a41ee55b8e

I'll take a couple of more days to add new tests to avoid regression before releasing 1.4.14 though, but you can use this commit if you need the fix right away.

I'll close this issue when the new hoel version will be included in glewlwyd

@sth so now I think I have the bug fixed for real in https://github.com/babelouest/hoel/commit/a41ee55b8e5f4c63fb4a1cf4129c8011227376e1 I'll take a couple of more days to add new tests to avoid regression before releasing 1.4.14 though, but you can use this commit if you need the fix right away. I'll close this issue when the new hoel version will be included in glewlwyd
babelouest commented 2020-02-11 06:38:59 +01:00 (Migrated from github.com)

Meanwhile, if you can confirm the bug is fixed, with this patch don't hesitate!

Meanwhile, if you can confirm the bug is fixed, with this patch don't hesitate!
sth commented 2020-02-12 00:25:32 +01:00 (Migrated from github.com)

@babelouest With the new library version it works!

@babelouest With the new library version it works!
This discussion has been locked. Commenting is limited to contributors.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
KittenSquad/glewlwyd#100
No description provided.