Skip to content

Commit

Permalink
Merge pull request #445 from oguzhantopcu/patch-1
Browse files Browse the repository at this point in the history
OOM fixed when image file is not in valid format.
  • Loading branch information
simogeo committed Jan 25, 2016
2 parents 98a91f1 + 4d0ed1b commit 007f6b1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions connectors/mvc/FilemanagerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,16 @@ private string GetFolderInfo(string path)

if (IsImage(fileInfo))
{
using (System.Drawing.Image img = System.Drawing.Image.FromFile(fileInfo.FullName))
try
{
using (System.Drawing.Image img = System.Drawing.Image.FromFile(fileInfo.FullName))
{
sb.AppendLine("\"Height\": " + img.Height.ToString() + ",");
sb.AppendLine("\"Width\": " + img.Width.ToString() + ",");
}
}
catch
{
sb.AppendLine("\"Height\": " + img.Height.ToString() + ",");
sb.AppendLine("\"Width\": " + img.Width.ToString() + ",");
}
}

Expand Down Expand Up @@ -615,4 +621,4 @@ private string Replace(string path)
}
}
}
}
}

0 comments on commit 007f6b1

Please sign in to comment.