Skip to content

Commit

Permalink
Fixed mantis #0002945: Thumbnail creation can generate an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
chemelli committed Jun 16, 2010
1 parent 5994b90 commit e366ad3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions mediaportal/Core/Util/Util.cs
Expand Up @@ -422,7 +422,7 @@ public static bool IsVideo(string strPath)
return false;
string extensionFile = Path.GetExtension(strPath).ToLower();

if(extensionFile == ".ts")
if (extensionFile == ".ts")
{
// Forced check to avoid users messed configuration ( .ts remove from Videos extensions list)
return true;
Expand Down Expand Up @@ -664,8 +664,16 @@ public static void SetThumbnails(ref GUIListItem item)
createVideoThumbs = xmlreader.GetValueAsBool("thumbnails", "tvrecordedondemand", true);
}

Uri file = new Uri(item.Path);
if (IsVideo(item.Path) && !VirtualDirectory.IsImageFile(Path.GetExtension(item.Path).ToLower()) && (file.IsUnc || file.IsFile))
bool isLocal = false;
if (!String.IsNullOrEmpty(item.Path) && Uri.IsWellFormedUriString(item.Path, UriKind.RelativeOrAbsolute))
{
Uri file = new Uri(item.Path);
if (file.IsUnc || file.IsFile)
{
isLocal = true;
}
}
if (isLocal && IsVideo(item.Path) && !VirtualDirectory.IsImageFile(Path.GetExtension(item.Path).ToLower()))
{
strThumb = String.Format(@"{0}\{1}.jpg", Thumbs.Videos, EncryptLine(item.Path));
if (File.Exists(strThumb))
Expand Down

0 comments on commit e366ad3

Please sign in to comment.