Francois Gouget : testbot/web: Don' t hardcode the Submit.pl maximum filename length.

Alexandre Julliard julliard at winehq.org
Thu May 31 14:31:28 CDT 2018


Module: tools
Branch: master
Commit: ec9869f683ab32313102d7cccfc39e4e3a62db89
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=ec9869f683ab32313102d7cccfc39e4e3a62db89

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu May 31 11:00:01 2018 +0200

testbot/web: Don't hardcode the Submit.pl maximum filename length.

Also check it before even starting the upload.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/web/Submit.pl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index cf85078..6451745 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -33,9 +33,10 @@ use File::Basename;
 use ObjectModel::BasicPropertyDescriptor;
 use WineTestBot::Branches;
 use WineTestBot::Config;
-use WineTestBot::Jobs;
 use WineTestBot::Engine::Notify;
+use WineTestBot::Jobs;
 use WineTestBot::PatchUtils;
+use WineTestBot::Steps;
 use WineTestBot::Utils;
 use WineTestBot::VMs;
 
@@ -609,10 +610,11 @@ sub OnPage1Next($)
       $FileName =~ m/^.*(\\|\/)(.*)/;
       $FileName = $2;
     }
-    if (100 - 32 - 1 < length($FileName))
+    my $PropertyDescriptor = CreateSteps()->GetPropertyDescriptorByName("FileName");
+    if ($PropertyDescriptor->GetMaxLength() - 32 - 1 < length($FileName))
     {
       $self->{ErrField} = "File";
-      $self->{ErrMessage} = "File: Name is too long";
+      $self->{ErrMessage} = "The filename is too long";
       return !1;
     }
     my $StagingFile = $self->GetTmpStagingFullPath($FileName);




More information about the wine-cvs mailing list