Merge branch 'develop'

This commit is contained in:
Mark McDowall 2014-01-26 15:39:43 -08:00
commit ef1cea55f3
5 changed files with 33 additions and 3 deletions

View File

@ -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/)

View File

@ -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))
{

View File

@ -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<Series>.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());
}
}
}

View File

@ -175,6 +175,8 @@ namespace NzbDrone.Core.Organizer
seasonFolder = ReplaceTokens(seasonFolder, tokenValues);
}
seasonFolder = CleanFilename(seasonFolder);
path = Path.Combine(path, seasonFolder);
}

View File

@ -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);