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

Francois Gouget fgouget at codeweavers.com
Thu May 31 04:00:01 CDT 2018


Also check it before even starting the upload.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 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 cf850788d..6451745a9 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);
-- 
2.17.0




More information about the wine-devel mailing list