Skip to content

Commit fdcfb58

Browse files
authored
Merge pull request #7784 from nextcloud/backport/7759/stable31
[stable31] Server-side validation for whitespace in title
2 parents d823be5 + 73b011c commit fdcfb58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/Validators/BaseValidator.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,14 @@ private function not_null($value): bool {
104104
* @return bool
105105
*/
106106
private function not_empty($value): bool {
107+
// Treat string zero as a valid non-empty value while still rejecting other empty values
108+
if ($value === '0') {
109+
return true;
110+
}
111+
112+
if (is_string($value)) {
113+
return strlen(trim($value)) > 0;
114+
}
107115
return !empty($value);
108116
}
109117

0 commit comments

Comments
 (0)