diff --git a/readme.md b/readme.md index 6d966203d..8dedd3217 100644 --- a/readme.md +++ b/readme.md @@ -39,6 +39,13 @@ NZBDrone is a PVR for newsgroup users. It can monitor multiple RSS feeds for new - Make sure `NzbDrone.Console` is set as the startup project -## License +### License ### * [GNU GPL v3](http://www.gnu.org/licenses/gpl.html) Copyright 2010-2013 + + +### Sponsors ### +- [JetBrains](http://www.jetbrains.com/) for providing us with free licenses to their great tools + - [ReSharper](http://www.jetbrains.com/resharper/) + - [WebStorm](http://www.jetbrains.com/webstorm/) + - [TeamCity](http://www.jetbrains.com/teamcity/) diff --git a/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs b/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs index 82ace5314..34d59ad94 100644 --- a/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs +++ b/src/NzbDrone.Api/Authentication/EnableStatelessAuthInNancy.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using Nancy; using Nancy.Bootstrapper; using NzbDrone.Api.Extensions; @@ -33,7 +34,9 @@ namespace NzbDrone.Api.Authentication return response; } - var apiKey = context.Request.Headers.Authorization; + var authorizationHeader = context.Request.Headers.Authorization; + var apiKeyHeader = context.Request.Headers["X-Api-Key"].FirstOrDefault(); + var apiKey = String.IsNullOrWhiteSpace(apiKeyHeader) ? authorizationHeader : apiKeyHeader; if (context.Request.IsApiRequest() && !ValidApiKey(apiKey) && !_authenticationService.IsAuthenticated(context)) { diff --git a/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs index 11866ea54..b7821aaf8 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/BuildFilePathFixture.cs @@ -43,5 +43,23 @@ namespace NzbDrone.Core.Test.OrganizerTests Subject.BuildFilePath(fakeSeries, seasonNumber, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic()); } + + [Test] + public void should_clean_season_folder_when_it_contains_illegal_characters_in_series_title() + { + var filename = @"S01E05 - Episode Title"; + var seasonNumber = 1; + var expectedPath = @"C:\Test\NCIS- Los Angeles\NCIS- Los Angeles Season 1\S01E05 - Episode Title.mkv"; + + var fakeSeries = Builder.CreateNew() + .With(s => s.Title = "NCIS: Los Angeles") + .With(s => s.Path = @"C:\Test\NCIS- Los Angeles".AsOsAgnostic()) + .With(s => s.SeasonFolder = true) + .Build(); + + namingConfig.SeasonFolderFormat = "{Series Title} Season {season:0}"; + + Subject.BuildFilePath(fakeSeries, seasonNumber, filename, ".mkv").Should().Be(expectedPath.AsOsAgnostic()); + } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index fa156552a..72a4ab75c 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -175,6 +175,8 @@ namespace NzbDrone.Core.Organizer seasonFolder = ReplaceTokens(seasonFolder, tokenValues); } + seasonFolder = CleanFilename(seasonFolder); + path = Path.Combine(path, seasonFolder); } diff --git a/src/UI/Mixins/jquery.ajax.js b/src/UI/Mixins/jquery.ajax.js index 0fe0b047f..5105d8ae8 100644 --- a/src/UI/Mixins/jquery.ajax.js +++ b/src/UI/Mixins/jquery.ajax.js @@ -25,7 +25,7 @@ define( if (xhr) { xhr.headers = xhr.headers || {}; - xhr.headers.Authorization = window.NzbDrone.ApiKey; + xhr.headers['X-Api-Key'] = window.NzbDrone.ApiKey; } return original.apply(this, arguments);