From: pcanterino <> Date: Tue, 5 Oct 2004 17:33:47 +0000 (+0000) Subject: Check if the user wants to write text data into a binary file when saving a file X-Git-Tag: version_2_1~4 X-Git-Url: https://git.p6c8.net/devedit.git/commitdiff_plain/ce4ed8bcf239ea532cc54bd872995a687de1c299 Check if the user wants to write text data into a binary file when saving a file --- diff --git a/errors.dat b/errors.dat index 338dbfe..606b336 100644 --- a/errors.dat +++ b/errors.dat @@ -5,6 +5,7 @@ editdir = You cannot edit directories. noedit = You have not enough permissions to edit this file. file_in_use = The file '{FILE}' is currently edited by someone else. edit_failed = Saving of file '{FILE}' failed. The file could be damaged, please check its integrity. +text_to_binary = You aren't allowed to write text data into a binary file. delete_failed = Could not delete file '{FILE}'. dir_read_fail = Reading of directory '{DIR}' failed. mkfile_failed = Could not create file '{FILE}'. diff --git a/modules/Command.pm b/modules/Command.pm index 0c2caf0..85b5fcf 100644 --- a/modules/Command.pm +++ b/modules/Command.pm @@ -354,8 +354,9 @@ sub exec_endedit($$) return error($config->{'errors'}->{'in_use'},upper_path($virtual),{FILE => $virtual}) if($uselist->in_use($virtual)); } - return error($config->{'errors'}->{'editdir'},upper_path($virtual)) if(-d $physical); - return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) if(-e $physical && !(-r $physical && -w $physical)); + return error($config->{'errors'}->{'text_to_binary'},upper_path($virtual)) unless(-T $physical); + return error($config->{'errors'}->{'editdir'},upper_path($virtual)) if(-d $physical); + return error($config->{'errors'}->{'noedit'}, upper_path($virtual)) if(-e $physical && !(-r $physical && -w $physical)); if(file_save($physical,\$content)) {