Skip to content

Commit

Permalink
add smb fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed May 10, 2017
1 parent 42b2f67 commit f15a6f5
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 15 deletions.
5 changes: 5 additions & 0 deletions Emby.Common.Implementations/IO/SharpCifsFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public string GetDirectoryName(string path)
if (separator == '/')
{
result = result.Replace('\\', '/');

if (result.StartsWith("smb:/", StringComparison.OrdinalIgnoreCase) && !result.StartsWith("smb://", StringComparison.OrdinalIgnoreCase))
{
result = result.Replace("smb:/", "smb://");
}
}

return result;
Expand Down
5 changes: 4 additions & 1 deletion Emby.Server.Core/ApplicationHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,10 @@ private ICertificate GetCertificate(CertificateInfo info)
return null;
}

X509Certificate2 localCert = new X509Certificate2(certificateLocation, info.Password);
// Don't use an empty string password
var password = string.IsNullOrWhiteSpace(info.Password) ? null : info.Password;

X509Certificate2 localCert = new X509Certificate2(certificateLocation, password);
//localCert.PrivateKey = PrivateKey.CreateFromFile(pvk_file).RSA;
if (!localCert.HasPrivateKey)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void SaveConfiguration()
Logger.Info("Saving system configuration");
var path = CommonApplicationPaths.SystemConfigurationFilePath;

FileSystem.CreateDirectory(Path.GetDirectoryName(path));
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));

lock (_configurationSyncLock)
{
Expand Down Expand Up @@ -293,7 +293,7 @@ public void SaveConfiguration(string key, object configuration)
_configurations.AddOrUpdate(key, configuration, (k, v) => configuration);

var path = GetConfigurationFile(key);
FileSystem.CreateDirectory(Path.GetDirectoryName(path));
FileSystem.CreateDirectory(FileSystem.GetDirectoryName(path));

lock (_configurationSyncLock)
{
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/AppBase/ConfigurationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static object GetXmlConfiguration(Type type, string path, IXmlSerializer
// If the file didn't exist before, or if something has changed, re-save
if (buffer == null || !buffer.SequenceEqual(newBytes))
{
fileSystem.CreateDirectory(Path.GetDirectoryName(path));
fileSystem.CreateDirectory(fileSystem.GetDirectoryName(path));

// Save it after load in case we got new items
fileSystem.WriteAllBytes(path, newBytes);
Expand Down
2 changes: 1 addition & 1 deletion Emby.Server.Implementations/Devices/DeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public async Task AcceptCameraUpload(string deviceId, Stream stream, LocalFileIn

_libraryMonitor.ReportFileSystemChangeBeginning(path);

_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));

try
{
Expand Down
4 changes: 2 additions & 2 deletions Emby.Server.Implementations/Devices/DeviceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private string GetDevicePath(string id)
public Task SaveDevice(DeviceInfo device)
{
var path = Path.Combine(GetDevicePath(device.Id), "device.json");
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));

lock (_syncLock)
{
Expand Down Expand Up @@ -180,7 +180,7 @@ public ContentUploadHistory GetCameraUploadHistory(string deviceId)
public void AddCameraUpload(string deviceId, LocalFileInfo file)
{
var path = Path.Combine(GetDevicePath(deviceId), "camerauploads.json");
_fileSystem.CreateDirectory(Path.GetDirectoryName(path));
_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));

lock (_syncLock)
{
Expand Down
4 changes: 2 additions & 2 deletions Emby.Server.Implementations/FFMpeg/FFMpegLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public async Task<FFMpegInfo> GetFFMpegInfo(StartupOptions options, IProgress<do
else
{
info = existingVersion;
versionedDirectoryPath = Path.GetDirectoryName(info.EncoderPath);
versionedDirectoryPath = _fileSystem.GetDirectoryName(info.EncoderPath);
excludeFromDeletions.Add(versionedDirectoryPath);
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ private FFMpegInfo GetExistingVersion(FFMpegInfo info, string rootEncoderPath)
{
EncoderPath = encoder,
ProbePath = probe,
Version = Path.GetFileName(Path.GetDirectoryName(probe))
Version = Path.GetFileName(_fileSystem.GetDirectoryName(probe))
};
}
}
Expand Down
1 change: 1 addition & 0 deletions Emby.Server.Implementations/Library/LibraryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ private async Task RunPostScanTasks(IProgress<double> progress, CancellationToke
catch (OperationCanceledException)
{
_logger.Info("Post-scan task cancelled: {0}", task.GetType().Name);
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation

while (yearNumber < maxYear)
{
cancellationToken.ThrowIfCancellationRequested();

try
{
var year = _libraryManager.GetYear(yearNumber);
Expand All @@ -35,7 +37,7 @@ public async Task Run(IProgress<double> progress, CancellationToken cancellation
catch (OperationCanceledException)
{
// Don't clutter the log
break;
throw;
}
catch (Exception ex)
{
Expand Down
Binary file modified ThirdParty/emby/Emby.Common.Implementations.dll
Binary file not shown.
Binary file modified ThirdParty/emby/Emby.Server.Core.dll
Binary file not shown.

0 comments on commit f15a6f5

Please sign in to comment.