mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
Make sure only json and xml files will be extracted from backup file, also limit max uncompressed size for backup and FFmpeg
This commit is contained in:
parent
411eaac42c
commit
1670e48a16
5 changed files with 15 additions and 11 deletions
|
@ -89,7 +89,7 @@ public static string ExtractPackage(string packageFilePath, string destination)
|
|||
}
|
||||
|
||||
return false;
|
||||
}, 20_000_000);
|
||||
}, 100_000_000);
|
||||
}
|
||||
|
||||
return configJson;
|
||||
|
|
|
@ -58,7 +58,7 @@ public static bool ExtractFFmpeg(string archivePath, string extractPath)
|
|||
{
|
||||
try
|
||||
{
|
||||
ZipManager.Extract(archivePath, extractPath, false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase));
|
||||
ZipManager.Extract(archivePath, extractPath, false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
|
@ -342,7 +342,7 @@ private static void CopyFFmpeg(string destination, bool include32bit, bool inclu
|
|||
if (!File.Exists(FFmpeg32bit))
|
||||
{
|
||||
string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-4.2.2-win32-static.zip");
|
||||
ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase));
|
||||
ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000);
|
||||
File.Move("ffmpeg.exe", FFmpeg32bit);
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ private static void CopyFFmpeg(string destination, bool include32bit, bool inclu
|
|||
if (!File.Exists(FFmpeg64bit))
|
||||
{
|
||||
string filename = SetupHelpers.DownloadFile("https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-4.2.2-win64-static.zip");
|
||||
ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase));
|
||||
ZipManager.Extract(filename, ".", false, entry => entry.Name.Equals("ffmpeg.exe", StringComparison.OrdinalIgnoreCase), 1_000_000_000);
|
||||
File.Move("ffmpeg.exe", FFmpeg64bit);
|
||||
}
|
||||
|
||||
|
|
|
@ -1660,7 +1660,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="cbExportHistory.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 80</value>
|
||||
<value>16, 88</value>
|
||||
</data>
|
||||
<data name="cbExportHistory.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>58, 17</value>
|
||||
|
@ -1687,7 +1687,7 @@
|
|||
<value>True</value>
|
||||
</data>
|
||||
<data name="cbExportSettings.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 56</value>
|
||||
<value>16, 64</value>
|
||||
</data>
|
||||
<data name="cbExportSettings.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>64, 17</value>
|
||||
|
@ -1741,7 +1741,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="btnResetSettings.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 168</value>
|
||||
<value>16, 176</value>
|
||||
</data>
|
||||
<data name="btnResetSettings.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>184, 24</value>
|
||||
|
@ -1768,7 +1768,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="pbExportImport.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>208, 104</value>
|
||||
<value>208, 112</value>
|
||||
</data>
|
||||
<data name="pbExportImport.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>184, 23</value>
|
||||
|
@ -1795,7 +1795,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="btnExport.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 104</value>
|
||||
<value>16, 112</value>
|
||||
</data>
|
||||
<data name="btnExport.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>184, 23</value>
|
||||
|
@ -1822,7 +1822,7 @@
|
|||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="btnImport.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>16, 136</value>
|
||||
<value>16, 144</value>
|
||||
</data>
|
||||
<data name="btnImport.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>184, 23</value>
|
||||
|
|
|
@ -391,7 +391,11 @@ public static bool Import(string archivePath)
|
|||
{
|
||||
try
|
||||
{
|
||||
ZipManager.Extract(archivePath, Program.PersonalFolder);
|
||||
ZipManager.Extract(archivePath, Program.PersonalFolder, true, entry =>
|
||||
{
|
||||
return Helpers.CheckExtension(entry.Name, new string[] { "json", "xml" });
|
||||
}, 1_000_000_000);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
Loading…
Reference in a new issue