]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1429110: Update Revision.pm type checking to treat bug id as a simple string
authordklawren <dklawren@users.noreply.github.com>
Tue, 9 Jan 2018 17:23:18 +0000 (12:23 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Jan 2018 17:23:18 +0000 (12:23 -0500)
extensions/PhabBugz/lib/Revision.pm

index e229043e267426a9d22d49998cf7691d83b2079a..59312b39d767798d5d037aea6a0c1f92e55d7c40 100644 (file)
@@ -22,12 +22,6 @@ use Bugzilla::Extension::PhabBugz::Util qw(
 use Types::Standard -all;
 use Type::Utils;
 
-my $EmptyStr = declare "EmptyStr",
-    as Str,
-    where { length($_) == 0 },
-    inline_as { $_[0]->parent->inline_check($_) . " && length($_) == 0" },
-    message { "String is not empty" };
-
 my $SearchResult = Dict[
     id     => Int,
     type   => Str,
@@ -42,7 +36,7 @@ my $SearchResult = Dict[
         repositoryPHID    => Maybe[Str],
         status            => HashRef,
         summary           => Str,
-        "bugzilla.bug-id" => Int | $EmptyStr,
+        "bugzilla.bug-id" => Str
     ],
     attachments => Dict[
         reviewers => Dict[
@@ -97,6 +91,10 @@ sub _load {
         $result = $result->{result}->{data}->[0];
     }
 
+    # Some values in Phabricator for bug ids may have been saved
+    # white whitespace so we remove any here just in case.
+    $result->{fields}->{'bugzilla.bug-id'} = trim($result->{fields}->{'bugzilla.bug-id'});
+
     return $result;
 }