Skip to content

Commit

Permalink
Merge pull request ledgersmb#8419 from walidmujahid/1.10
Browse files Browse the repository at this point in the history
feat: allow hyphen in host
  • Loading branch information
ehuelsmann authored Oct 2, 2024
2 parents 7301a62 + 1c9e025 commit 8322930
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/LedgerSMB/Admin/Command.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ sub connect_data_from_arg {
$arg =~ m!^
(postgresql://)?
(((?<user>[^@]+)@)?
(?<host>\[[:0-9a-zA-Z]+\]|[\w.]+)
(?<host>\[[:0-9a-zA-Z]+\]|[\w.-]+)
(:(?<port>\d+))?/)?
((?<dbname>[a-z0-9A-Z_% -]+)
(\#(?<schema>[a-z0-9A-Z_% -]+))?
Expand Down Expand Up @@ -100,12 +100,13 @@ sub connect_data_from_arg {
sub dispatch {
my ($self, $command, @args) = @_;

$command //= 'help';
my $dispatch = $self->can($command);
die "Unknown command '$command'"
my $func = $command // 'help';
$func =~ tr/\-/_/;
my $dispatch = $self->can($func);
die "Unknown command '$command' ($func)"
if (not $dispatch
or ($command eq 'run')
or ($command !~ m/^([a-zA-Z]+)$/));
or ($func !~ m/^([a-zA-Z_]+)$/));

return $self->help($command, @args)
if $command eq 'help';
Expand Down Expand Up @@ -211,4 +212,3 @@ Copyright (C) 2020 The LedgerSMB Core Team
This file is licensed under the GNU General Public License version 2, or at your
option any later version. A copy of the license should have been included with
your software.

0 comments on commit 8322930

Please sign in to comment.