friendica.mbbit.de

Inconsistent usage for image upload limit values 0 and -1

Hello @Friendica Developers I like to ask you about your opinion regarding the issue:

Currently, I am reworking the upload size limits description and usage for images on the Admin site. I encountered IMHO an inconsistency in the semantic of providing '0' and '-1' as a limit value:


  • For the maximum size 0 means unlimited, but this is yet not interpreted that way in the code (there it is only compared if the image size is grater than the limit, which in case of 0 just rejects any file)
  • For the maximum length -1 mean unlimited


Question: Which values should we use, and how should they be interpreted in the code base? For me, it would make sens to use "-1" in general for no limit and "0" for deactivated. But what would "0" then mean in the case of "image length"?

Any thoughts?

1
Hypolite Petovan friendica (via ActivityPub)
@Marek Bachmann :friendica: You should use -1 for when the value 0 makes distinct sense. For a limit, 0 is enough to consider it unlimited.
1
In other words, 0 should also be used to indicate no restrictions to image length?
1
Hypolite Petovan friendica (via ActivityPub)
@Marek Bachmann :friendica: I believe so in this case, but your suggestion of an additional "Upload disabled" feature is interesting even if I'm not personally favorable to it.
1
I am not prioritizing nor advertising such a feature, neither. This option, only came to my awareness while digging through the code. I think this option won't do any harm either, since there might be situations where admins might favor to do not allow image upload, e.g. for legal reasons.
My focus is more on consistency regarding the meaning of the numbers for the limits. :-)
2 1
Hypolite Petovan friendica (via ActivityPub)
@Marek Bachmann :friendica: The feature might be useful, but it needs to be clearly advertised to users, which may be the hardest part of this feature.
1