diff options
author | jake <jake@jakes-mail.top> | 2022-08-15 08:41:10 -0400 |
---|---|---|
committer | jake <jake@jakes-mail.top> | 2022-08-15 08:41:10 -0400 |
commit | a4e2e344728b5642814877ff908d90d308c33032 (patch) | |
tree | 9b1ba7ade731464b5e19ca980e10c43e1cd264b7 | |
parent | a4c619b7af15b247a57e17b275d0eb84d2015d67 (diff) |
Fix redirection bug
-rw-r--r-- | TO_FIX.md | 1 | ||||
-rwxr-xr-x | gmi.pl | 6 |
2 files changed, 3 insertions, 4 deletions
@@ -5,7 +5,6 @@ add systemd unit? gmi.pl needs to accept an arguemnt, where the config.toml is located. remove magic numbers -redirection bug where path = /share/dir, redirection says '30 share/dir/' resulting in '/share/share/dir/' in dir_listing, if a file has white space, then it will not properly display. server does not do anything with '%20' (whitespace) in path at all. @@ -7,7 +7,7 @@ use warnings; use 5.010; #use diagnostics; -our $VERSION = 'v0.0.4'; +our $VERSION = 'v0.0.5'; # Modules use IO::Socket::SSL; # CPAN @@ -405,8 +405,8 @@ while () { } elsif (-d $doc_loc) { # make sure 'dir' is 'dir/' - if (substr($doc_loc,-1,1) ne '/') { - speak($cl, 'redirect', "$path/"); + if (substr($doc_loc,-1,1) ne '/') { + speak($cl, 'redirect', @{ split_url_path($path, 256) }[-1]. "/"); goto CLOSE; } |