From: pcanterino <> Date: Mon, 4 Oct 2004 17:50:05 +0000 (+0000) Subject: Improved file editing using another filename: X-Git-Tag: version_2_1~5 X-Git-Url: https://git.p6c8.net/devedit.git/commitdiff_plain/f6b35ba3aaa4cb67ac80c6cff80e541996f76e80?ds=inline;hp=4e40e9a450e412da79b7c3ef4a1eaae268b206a4 Improved file editing using another filename: - If the user just entered spaces as filename (detection works for other commands using the "newfile" CGI parameter too), we use the original filename - Saving even works if the file has to be created first --- diff --git a/modules/Command.pm b/modules/Command.pm index 967615d..0c2caf0 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -6,7 +6,7 @@ package Command; # Execute Dev-Editor's commands # # Author: Patrick Canterino -# Last modified: 2004-09-05 +# Last modified: 2004-10-04 # use strict; @@ -342,7 +342,7 @@ sub exec_endedit($$) $content = encode_entities($content,"\200-\377"); } - if($data->{'cgi'}->param('saveas')) + if($data->{'cgi'}->param('saveas') && $data->{'new_physical'} ne '' && $data->{'new_virtual'} ne '') { # Create the new filename @@ -355,7 +355,7 @@ sub exec_endedit($$) } return error($config->{'errors'}->{'editdir'},upper_path($virtual)) if(-d $physical); - return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) unless(-r $physical && -w $physical); + return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) if(-e $physical && !(-r $physical && -w $physical)); if(file_save($physical,\$content)) {