File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717class DomainHelper {
1818 // @return string - the domain name encoded in ASCII-compatible form
1919 public static function encode ($ string ) {
20- $ result = idn_to_ascii ($ string );
21-
22- // return the original input if encoding failed
23- if ($ result === false ) {
24- $ result = $ string ;
20+ $ result = $ string ;
21+ if (!empty ($ string )) {
22+ $ result = idn_to_ascii ($ string );
2523 }
2624
2725 return $ result ;
2826 }
2927
3028 // @return string - the domain name in Unicode, encoded in UTF-8
3129 public static function decode ($ string ) {
32- $ result = idn_to_utf8 ($ string );
33-
34- // return the original input if decoding failed
35- if ($ result === false ) {
36- $ result = $ string ;
30+ $ result = $ string ;
31+ if (!empty ($ string )) {
32+ $ result = idn_to_utf8 ($ string );
3733 }
3834
3935 return $ result ;
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ public function create(Request $request): Response {
5151
5252 // TODO extra validation that username is correct?
5353 $ request ->validate ([
54+ 'domain ' => 'required ' ,
5455 'sitename ' => 'required|min:3 ' ,
5556 'username ' => 'required ' ,
5657 'profile ' => 'nullable|json ' ,
You can’t perform that action at this time.
0 commit comments