Support using pipe characters within egg validation rules; closes #1960
This commit is contained in:
		
							parent
							
								
									69eb33fb89
								
							
						
					
					
						commit
						49dee28eb8
					
				@ -2,6 +2,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Pterodactyl\Services\Eggs\Variables;
 | 
					namespace Pterodactyl\Services\Eggs\Variables;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Illuminate\Support\Str;
 | 
				
			||||||
use Pterodactyl\Models\EggVariable;
 | 
					use Pterodactyl\Models\EggVariable;
 | 
				
			||||||
use Illuminate\Contracts\Validation\Factory;
 | 
					use Illuminate\Contracts\Validation\Factory;
 | 
				
			||||||
use Pterodactyl\Exceptions\DisplayException;
 | 
					use Pterodactyl\Exceptions\DisplayException;
 | 
				
			||||||
@ -81,7 +82,11 @@ class VariableUpdateService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! empty($data['rules'] ?? '')) {
 | 
					        if (! empty($data['rules'] ?? '')) {
 | 
				
			||||||
            $this->validateRules($data['rules']);
 | 
					            $this->validateRules(
 | 
				
			||||||
 | 
					                (is_string($data['rules']) && Str::contains($data['rules'], ';;'))
 | 
				
			||||||
 | 
					                    ? explode(';;', $data['rules'])
 | 
				
			||||||
 | 
					                    : $data['rules']
 | 
				
			||||||
 | 
					            );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $options = array_get($data, 'options') ?? [];
 | 
					        $options = array_get($data, 'options') ?? [];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user