diff --git a/.github/lock.yml b/.github/lock.yml
new file mode 100644
index 0000000..d0aae88
--- /dev/null
+++ b/.github/lock.yml
@@ -0,0 +1,14 @@
+daysUntilLock: 90
+
+skipCreatedBefore: false
+
+exemptLabels: []
+
+lockLabel: false
+
+lockComment: >
+ This thread has been automatically locked since there has not been
+ any recent activity after it was closed. Please open a new issue for
+ related problems.
+
+setLockReason: true
diff --git a/PersianBingCalendar/Core/BingImagesDownloader.cs b/PersianBingCalendar/Core/BingImagesDownloader.cs
index 17c1f50..cf3768b 100644
--- a/PersianBingCalendar/Core/BingImagesDownloader.cs
+++ b/PersianBingCalendar/Core/BingImagesDownloader.cs
@@ -4,6 +4,7 @@
using System.Text;
using PersianBingCalendar.Models;
using PersianBingCalendar.Utils;
+using System.Net.Http;
namespace PersianBingCalendar.Core
{
@@ -55,7 +56,7 @@ private static void downloadImage(
var imageInfo = getFullUrl(xmlData);
- var imageName = Path.GetFileName(imageInfo.Url).CleanFileName();
+ var imageName = getImageName(imageInfo);
var imagePath = Path.Combine(dir, $"{imageName}");
var xmlFileName = imageName.Split('_').First();
@@ -78,5 +79,18 @@ private static void downloadImage(
File.Delete(imagePath);
}
}
+
+ private static string getImageName(ImageInfo imageInfo)
+ {
+ var imageName = Path.GetFileName(imageInfo.Url).CleanFileName();
+ if (imageName.EndsWith(".jpg", StringComparison.OrdinalIgnoreCase))
+ {
+ return imageName;
+ }
+
+ var nameValueCollection = new Uri(imageInfo.Url).ParseQueryString();
+ var id = nameValueCollection["id"];
+ return string.IsNullOrWhiteSpace(id) ? imageName : id.CleanFileName();
+ }
}
}
\ No newline at end of file
diff --git a/PersianBingCalendar/PersianBingCalendar.csproj b/PersianBingCalendar/PersianBingCalendar.csproj
index 336e2ae..343e5da 100644
--- a/PersianBingCalendar/PersianBingCalendar.csproj
+++ b/PersianBingCalendar/PersianBingCalendar.csproj
@@ -41,6 +41,7 @@
+
diff --git a/PersianBingCalendar/Properties/AssemblyInfo.cs b/PersianBingCalendar/Properties/AssemblyInfo.cs
index b290e70..13f89b0 100644
--- a/PersianBingCalendar/Properties/AssemblyInfo.cs
+++ b/PersianBingCalendar/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.1.0.0")]
-[assembly: AssemblyFileVersion("2.1.0.0")]
+[assembly: AssemblyVersion("2.2.0.0")]
+[assembly: AssemblyFileVersion("2.2.0.0")]