diff options
author | jake <jake@jakes-mail.top> | 2022-08-15 08:56:11 -0400 |
---|---|---|
committer | jake <jake@jakes-mail.top> | 2022-08-15 08:58:13 -0400 |
commit | 9969ee032f73d03ff9dcb5246eced784ce234c87 (patch) | |
tree | 2e14b7edb5803264df5b13364b2a5868f4413dd4 /gmi.pl | |
parent | a4e2e344728b5642814877ff908d90d308c33032 (diff) |
Handle space (%20) in path
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -7,7 +7,7 @@ use warnings; use 5.010; #use diagnostics; -our $VERSION = 'v0.0.5'; +our $VERSION = 'v0.0.6'; # Modules use IO::Socket::SSL; # CPAN @@ -15,7 +15,7 @@ use IO::Socket::SSL::Utils; # CPAN use URL::XS qw(parse_url split_url_path parse_url_query); # CPAN #use Term::ANSIColor; # Core use Path::Naive qw(normalize_path); # CPAN -#use Smart::Comments; # CPAN +use Smart::Comments; # CPAN use URI::Encode qw(uri_encode); # CPAN use IO::Select; use TOML qw(from_toml); @@ -500,6 +500,11 @@ sub dir_listing { if (substr($i,0,1) eq '.') { # dont display hidden files next; } + + # convert space into %20 + # (there is probably an edge-case bug here) + $i =~ s/ /%20/g; + $doc .= "=> $i"; if (-d "$doc_loc/$i") { $doc .= '/'; @@ -543,6 +548,9 @@ sub get_request_in_vhost_root { # remove '..' $request =~ s/\.\.//g if ($request); + + # convert %20 into space + $request =~ s/%20/ /g if ($request); $r = normalize_path($request) if ($request); |