Skip to content

Commit

Permalink
Do not show illegal link
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Axel 'fREW' Schmidt committed Sep 22, 2015
1 parent b98057e commit 778920c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/WWW/RetroPie/Game/Picker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ sub dispatch_request {
return $self->_forbidden unless $system =~ m/^[\w]+$/;

'/' => sub {
my %links =
map { readlink $_ => 1 }
grep -l $_,
map "$_",
io->dir($self->_config->retropie_roms_dir, $system)->all;
my $html =
join "\n",
map qq(<li>$_ [<a href="/all/$system/$_/pick">Pick</a>]</li>),
map $_->filename,
io->dir($self->_config->real_roms_dir, $system)->all;
map {
my $fn = $_->filename;
"<li>$fn [" . (
$links{$_->name}
? '<strike>Pick</strike>'
: qq(<a href="/all/$system/$fn/pick">Pick</a>)
) . ']</li>'
} io->dir($self->_config->real_roms_dir, $system)->all;

return [ 200, [ content_type => 'text/html' ], [ "<html><ul>$html</ul></html>" ] ]
},
Expand Down

0 comments on commit 778920c

Please sign in to comment.