From 9969ee032f73d03ff9dcb5246eced784ce234c87 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 15 Aug 2022 08:56:11 -0400 Subject: Handle space (%20) in path --- gmi.pl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gmi.pl') diff --git a/gmi.pl b/gmi.pl index b292ba2..69a87e9 100755 --- a/gmi.pl +++ b/gmi.pl @@ -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); -- cgit v1.2.3