From d4f70f7cdf21126c64370cbc2657de24271a0571 Mon Sep 17 00:00:00 2001 From: "DESKTOP-521QCS7\\Ranadheer Reddy P" Date: Tue, 14 Nov 2017 16:10:49 +0530 Subject: [PATCH] Fixed JIRA attachments downloading issue. --- TicketImporter/JiraProject.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TicketImporter/JiraProject.cs b/TicketImporter/JiraProject.cs index 51e2a54..b1db19f 100644 --- a/TicketImporter/JiraProject.cs +++ b/TicketImporter/JiraProject.cs @@ -25,7 +25,7 @@ You should have received a copy of the GNU General Public License using System.IO; using System.Linq; using System.Net; -using RestSharp.Extensions; +using System.Text; using TechTalk.JiraRestClient; using TicketImporter.Interface; using TrackProgress; @@ -189,8 +189,8 @@ public void DownloadAttachments(Ticket ticket, string downloadFolder) foreach (var attachment in ticket.Attachments) { onDetailedProcessing("Downloading " + attachment.FileName); - var sourceUri = string.Format("{0}?&os_username={1}&os_password={2}", - attachment.Source, userName, password); + var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(userName + ":" + password)); + var sourceUri = attachment.Source; string name = Path.GetFileNameWithoutExtension(attachment.FileName), extension = Path.GetExtension(attachment.FileName), downloadedName = attachment.FileName; @@ -207,6 +207,7 @@ public void DownloadAttachments(Ticket ticket, string downloadFolder) try { var downloadTo = Path.Combine(downloadFolder, downloadedName); + webClient.Headers[HttpRequestHeader.Authorization] = string.Format("Basic {0}", credentials); webClient.DownloadFile(new Uri(sourceUri), downloadTo); attachment.Source = downloadTo; attachment.FileName = downloadedName;