From ce4ed8bcf239ea532cc54bd872995a687de1c299 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Tue, 5 Oct 2004 17:33:47 +0000 Subject: [PATCH] Check if the user wants to write text data into a binary file when saving a file --- errors.dat | 1 + modules/Command.pm | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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)) { -- 2.34.1