summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Migrate
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Migrate')
-rw-r--r--Bugzilla/Migrate/Flyspray.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index 6da7f9752..9f4c05000 100644
--- a/Bugzilla/Migrate/Flyspray.pm
+++ b/Bugzilla/Migrate/Flyspray.pm
@@ -20,7 +20,9 @@ use Bugzilla::DB;
use IO::File;
use List::Util qw(first none);
use SQL::Abstract;
+use File::MimeInfo;
+# FIXME: this is currently broken in Bugzilla::Migrate
#use constant REQUIRED_MODULES => [
#{
#package => 'SQL-Abstract',
@@ -305,11 +307,12 @@ sub _read_bugs {
LEFT OUTER JOIN $fsdb.${fsprfx}list_status ls ON ls.status_id = t.item_status
LEFT OUTER JOIN $fsdb.${fsprfx}list_resolution lr ON lr.resolution_id = t.resolution_reason
LEFT OUTER JOIN $fsdb.${fsprfx}list_version lv ON lv.version_id = t.product_version
- WHERE t.task_id IN (21668, 22102, 23845, 23884)
GROUP BY t.task_id, a.task_id
");
$sth->execute();
+ #WHERE t.task_id IN (21668, 22102, 23845, 23884)
+
my @result;
while (my $row = $sth->fetchrow_hashref()) {
my $bug = {
@@ -410,7 +413,7 @@ sub _read_bugs {
removed => "",
added => $history->{resolution_name},
};
- if ($self->translate_value('resolution', $history->{resolution_name}) eq
+ if ($self->translate_value('resolution', $history->{resolution_name} // "") eq
"DUPLICATE")
{
if ($closure_comment =~ m/FS#(\d+)/) {
@@ -448,15 +451,17 @@ sub _read_bugs {
$attachments_sth->execute($row->{task_id});
my $attpath = $self->config("attachment_path");
while (my $attachment = $attachments_sth->fetchrow_hashref()) {
+ my $path = $attpath . '/' . $attachment->{file_name};
+ next unless -f $path;
push @{$bug->{attachments}},
{
submitter => $self->_get_username($attachment->{added_by}),
creation_ts => $attachment->{date_added},
description => $attachment->{file_desc} || $attachment->{orig_name},
filename => $attachment->{orig_name},
- mimetype => $attachment->{file_type},
+ mimetype => $attachment->{file_type} || mimetype($path),
ispatch => $attachment->{file_type} =~ m/^text\/x-diff/ ? 1 : 0,
- data => IO::File->new($attpath . '/' . $attachment->{file_name}, 'r'),
+ data_path => $path,
};
# TODO: set extra_data and type of comment when attachment is part of a comment.