Skip to content
Permalink
Browse files

Merge remote-tracking branch 'remotes/origin/MP1-4954-Hardcoded_check…

…_for_HTTP_does_not_work_with_URL_starting_at_HTTPS' into MP1-1.22-Full_test
  • Loading branch information...
owlsroost committed Apr 17, 2019
2 parents 0a6d321 + f23fd2c commit 21f6a8addea4cfae4292411e791ed04e0889f10e
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2011 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -3044,12 +3044,12 @@ private int BinarySearch(ListView.ListViewItemCollection items, string item)
// Save thumbs for covers and actors, database update with pic link
private void UpdateActiveMovieImageAndThumbs(string strImageUrl, int movieID, string movieTitle)
{
if (strImageUrl == string.Empty)
if (string.IsNullOrEmpty(strImageUrl))
{
return;
}

bool bIsUrl = (strImageUrl.Substring(0, 7) == @"http://");
bool bIsUrl = (strImageUrl.StartsWith(@"http://") || strImageUrl.StartsWith(@"https://"));

// Clear previous image
if (pictureBoxCover.Image != null)
@@ -3349,7 +3349,7 @@ private void RefreshMissingCovers(object sender, DoWorkEventArgs e)
_progressDialog.SetLine1("Downloading cover for: " + movie.Title);

// Skip no thumb URL movie ...
if (string.IsNullOrEmpty(movie.ThumbURL) || movie.ThumbURL.Length <= 7 || (movie.ThumbURL.Length > 7 && !movie.ThumbURL.Substring(0, 7).Equals("http://")))
if (string.IsNullOrEmpty(movie.ThumbURL) || movie.ThumbURL.Length <= 10 || (!movie.ThumbURL.StartsWith(@"http://") && !movie.ThumbURL.StartsWith(@"https://")))
{
if (_progressDialog.Count < movies.Count - 1)
_progressDialog.Count++;
@@ -3896,9 +3896,9 @@ private void SaveActorInfo()
imdbActor.DateOfDeath = tbDeathDate.Text;
imdbActor.PlaceOfDeath = tbDeathPlace.Text;

if (tbThumbLoc.Text != string.Empty && tbThumbLoc.Text.Length >= 7)
if (!string.IsNullOrEmpty(tbThumbLoc.Text) && tbThumbLoc.Text.Length > 10)
{
bool isUrl = (tbThumbLoc.Text.Substring(0, 7) == @"http://" || tbThumbLoc.Text.Substring(0, 7) == @"file://");
bool isUrl = (tbThumbLoc.Text.StartsWith(@"http://") || tbThumbLoc.Text.StartsWith(@"file://") || tbThumbLoc.Text.StartsWith(@"https://"));
if (isUrl)
{
imdbActor.ThumbnailUrl = tbThumbLoc.Text;
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2011 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -79,18 +79,19 @@ public string FanartMovieFile
/// <param name="index"></param>
public void GetLocalFanart(int movieId, string localFile, int index)
{
if (localFile == string.Empty)
if (string.IsNullOrEmpty(localFile))
{
return;
}

bool isUrl = true;

if (localFile.Length > 7 && localFile.Substring(0, 7).Equals("file://"))
if (localFile.Length > 10 && localFile.StartsWith(@"file://"))
{
localFile = localFile.Replace("file://", "");
isUrl = false;
}
else if (localFile.Length > 7 && !localFile.Substring(0, 7).Equals("http://"))
else if (localFile.Length > 10 && !localFile.StartsWith(@"http://") && !localFile.StartsWith(@"https://"))
{
return;
}
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2011 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -1769,7 +1769,8 @@ public static bool IsISOImage(string fileName)
{
string extension = Path.GetExtension(fileName).ToLowerInvariant();
// check for "http" to prevent exception
if (string.IsNullOrEmpty(fileName) || fileName.StartsWith("http://") || !File.Exists(fileName) || (extension == ".tsbuffer" || extension == ".ts"))
if (string.IsNullOrEmpty(fileName) || fileName.StartsWith("http://") || fileName.StartsWith("https://") ||
!File.Exists(fileName) || (extension == ".tsbuffer" || extension == ".ts"))
return false;

string vDrive = DaemonTools.GetVirtualDrive();
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2011 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -1004,7 +1004,7 @@ private void OnThreadMessage(GUIMessage message)
//if (handler != null && handler.CurrentView == "Top100") return;
}
string strFile = message.Label;
if (strFile.StartsWith(@"http://"))
if (strFile.StartsWith(@"http://") || strFile.StartsWith(@"https://"))
{
break; // Don't try increasing the Top100 for streams
}
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2011 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2011 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -829,7 +829,7 @@ private void GetDetails(GUIListItem item)
}

// Save cover url into db
if (cover.StartsWith("http://") || _forceRefreshAll)
if (cover.StartsWith("http://") || cover.StartsWith("https://") || _forceRefreshAll)
{
SetThumb(ref item, cover);
}
@@ -1,6 +1,6 @@
#region Copyright (C) 2005-2018 Team MediaPortal
#region Copyright (C) 2005-2019 Team MediaPortal

// Copyright (C) 2005-2018 Team MediaPortal
// Copyright (C) 2005-2019 Team MediaPortal
// http://www.team-mediaportal.com
//
// MediaPortal is free software: you can redistribute it and/or modify
@@ -913,9 +913,7 @@ private void Refresh()
string titleCoverFilename = string.Empty;
string imageExt = string.Empty;

if (imageUrl.Length > 7 &&
!imageUrl.Substring(0, 7).Equals("file://") &&
!imageUrl.Substring(0, 7).Equals("http://"))
if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 10 && !imageUrl.StartsWith(@"file://") && !imageUrl.StartsWith(@"http://") && !imageUrl.StartsWith(@"https://"))
{
imageExt = Util.Utils.GetFileExtension(imageUrl);
if ((Util.Utils.IsPicture(imageUrl) || imageExt.ToLowerInvariant() == ".tbn") && File.Exists(imageUrl))
@@ -924,8 +922,7 @@ private void Refresh()
}
}

if (imageUrl.Length > 7 && (imageUrl.Substring(0, 7).Equals("file://") ||
imageUrl.Substring(0, 7).Equals("http://")))
if (!string.IsNullOrEmpty(imageUrl) && imageUrl.Length > 10 && (imageUrl.StartsWith(@"file://") || imageUrl.StartsWith(@"http://") || imageUrl.StartsWith(@"https://")))
{
// Set cover thumb filename (movieTitle{movieId})
titleCoverFilename = _currentMovie.Title + "{" + _currentMovie.ID + "}";
@@ -1702,7 +1699,8 @@ private void OnFanartRefresh()
// Cover refresh
private void OnCoverRefresh()
{
if (string.IsNullOrEmpty(_currentMovie.ThumbURL) || _currentMovie.ThumbURL.Length <= 7 || (_currentMovie.ThumbURL.Length > 7 && !_currentMovie.ThumbURL.Substring(0, 7).Equals("http://")))
if (string.IsNullOrEmpty(_currentMovie.ThumbURL) || _currentMovie.ThumbURL.Length <= 10 ||
(_currentMovie.ThumbURL.Length > 10 && !_currentMovie.ThumbURL.StartsWith(@"http://") && !_currentMovie.ThumbURL.StartsWith(@"https://")))
{
return;
}

0 comments on commit 21f6a8a

Please sign in to comment.
You can’t perform that action at this time.