From 12666937e2d7aba0f1d9c0a9a9741dc2afb2ab3b Mon Sep 17 00:00:00 2001
From: sr55 <sr55.hb@outlook.com>
Date: Sat, 15 Oct 2011 14:18:56 +0000
Subject: WinGui: Fix a bug in the AutoName function when the source name has
 invalid characters for a file path.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4288 b64f7644-9d1e-0410-96f1-a4d463321fa5
---
 win/CS/Functions/Main.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'win')

diff --git a/win/CS/Functions/Main.cs b/win/CS/Functions/Main.cs
index 8d88871c2..728747864 100644
--- a/win/CS/Functions/Main.cs
+++ b/win/CS/Functions/Main.cs
@@ -176,7 +176,8 @@ namespace Handbrake.Functions
             if (mainWindow.drp_dvdtitle.Text != "Automatic")
             {
                 // Get the Source Name and remove any invalid characters
-                string sourceName = Path.GetInvalidFileNameChars().Aggregate(Path.GetFileNameWithoutExtension(mainWindow.SourceName), (current, character) => current.Replace(character.ToString(), string.Empty));
+                string sourceName = Path.GetInvalidFileNameChars().Aggregate(mainWindow.SourceName, (current, character) => current.Replace(character.ToString(), string.Empty));
+                sourceName = Path.GetFileNameWithoutExtension(sourceName);
 
                 // Remove Underscores
                 if (UserSettingService.GetUserSetting<bool>(UserSettingConstants.AutoNameRemoveUnderscore))
-- 
cgit v1.2.3