diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-12-27 16:50:09 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-12-06 11:05:42 +0100 |
commit | 1b00de587da2e1baea9b8753c6465c7f529304aa (patch) | |
tree | 633acea6b4fd856cdd20b6db11547edcc5d468f0 /Bugzilla/Migrate/Flyspray.pm | |
parent | bcc998174abf8a95905dc41c22eb5b238895d976 (diff) | |
download | bugzilla-1b00de587da2e1baea9b8753c6465c7f529304aa.tar.gz bugzilla-1b00de587da2e1baea9b8753c6465c7f529304aa.tar.xz |
WIP: misc fixes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla/Migrate/Flyspray.pm')
-rw-r--r-- | Bugzilla/Migrate/Flyspray.pm | 13 |
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. |