[Bug / 'logical mistake'] avatar upload size permissions - infinite value not highest value

I found a bug regarding the permission i_client_max_avatar_filesize.

The server normally grants you always the permissions from the highest rank you have assigned.
But this doesnt apply to -1 (infinite value)
I guess it’s because -1 is smaller than every positive number

E.g., your assigned server groups are groupA, groupB and groupC.
and you max. avatar upload sizes (i_client_max_avatar_filesize) are:

1024 at groupA,
2048 at groupB and
4096 at groupC

You can upload an avatar with up to 4kB (groupC has the highest value).
So far so good.

If I now add groupD with -1 as avatar upload size, I am still limited to 4kB.
-1 is mathematically the smallest value, but logically the largest (because it means infinite).

I can reproduce the error on server version 3.13.6 (Linux),
with both clients (v3.5.6 and 5.0.0-beta61.1).

This is working as intended and why there is a negate flag.
Instead of doing
i_client_max_avatar_filesize value=-1 skip=0 negated=0
you do
i_client_max_avatar_filesize value=-1 skip=0 negated=1

Which will cause the lowest value to win when merging server group permissions. As such if you have a server group that specifies -1 and you want people that have this group to have the lower number of a permission, you enable the negate box for that permission.

6 Likes