Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/Readarr/commit/e03ab2ebeaa307d028175fc992d7e2d6354e51d0
You should set ROOT_URL correctly, otherwise the web may not work correctly.
5 changed files with
52 additions and
16 deletions
@ -200,21 +200,49 @@ namespace NzbDrone.Common
File . SetAccessControl ( filename , fs ) ;
}
public virtual u long GetAvilableSpace ( string path )
public virtual long GetAvilableSpace ( string path )
{
if ( ! FolderExists ( path ) )
throw new DirectoryNotFoundException ( path ) ;
ulong freeBytesAvailable ;
ulong totalNumberOfBytes ;
ulong totalNumberOfFreeBytes ;
bool success = GetDiskFreeSpaceEx ( path , out freeBytesAvailable , out totalNumberOfBytes ,
out totalNumberOfFreeBytes ) ;
if ( ! success )
throw new System . ComponentModel . Win32Exception ( ) ;
var driveInfo = DriveInfo . GetDrives ( ) . SingleOrDefault ( c = > c . IsReady & & c . Name . Equals ( Path . GetPathRoot ( path ) , StringComparison . CurrentCultureIgnoreCase ) ) ;
return freeBytesAvailable ;
if ( driveInfo = = null )
{
if ( EnvironmentProvider . IsLinux )
{
return 0 ;
}
return DriveFreeSpaceEx ( path ) ;
}
return driveInfo . AvailableFreeSpace ;
}
private static long DriveFreeSpaceEx ( string folderName )
{
if ( string . IsNullOrEmpty ( folderName ) )
{
throw new ArgumentNullException ( "folderName" ) ;
}
if ( ! folderName . EndsWith ( "\\" ) )
{
folderName + = '\\' ;
}
ulong free = 0 ;
ulong dummy1 = 0 ;
ulong dummy2 = 0 ;
if ( GetDiskFreeSpaceEx ( folderName , out free , out dummy1 , out dummy2 ) )
{
return ( long ) free ;
}
return 0 ;
}
public virtual string ReadAllText ( string filePath )
@ -31,7 +31,7 @@ namespace NzbDrone.Common
return info . FullName . TrimEnd ( '/' ) . Trim ( '\\' , ' ' ) ;
}
static string GetProperDirectoryCapitalization ( DirectoryInfo dirInfo )
private static string GetProperDirectoryCapitalization ( DirectoryInfo dirInfo )
{
var parentDirInfo = dirInfo . Parent ;
if ( null = = parentDirInfo )
@ -40,7 +40,7 @@ namespace NzbDrone.Common
parentDirInfo . GetDirectories ( dirInfo . Name ) [ 0 ] . Name ) ;
}
static string GetProperFilePathCapitalization ( string filename )
public static string GetActualCasing ( this string filename )
{
var fileInfo = new FileInfo ( filename ) ;
DirectoryInfo dirInfo = fileInfo . Directory ;
@ -13,10 +13,18 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskProviderTests
public void should_return_free_disk_space ( )
{
var result = Subject . GetAvilableSpace ( Directory . GetCurrentDirectory ( ) ) ;
result . Should ( ) . BeGreaterThan ( 0 ) ;
}
[Test]
public void should_be_able_to_get_space_on_unc ( )
{
WindowsOnly ( ) ;
//Checks to ensure that the free space on the first is greater than 0 (It should be in 99.99999999999999% of cases... I hope)
var result = Subject . GetAvilableSpace ( @"\\localhost\c$\Windows" ) ;
result . Should ( ) . BeGreaterThan ( 0 ) ;
}
[Test]
public void should_throw_if_drive_doesnt_exist ( )
{
@ -8,7 +8,7 @@ namespace NzbDrone.Core.RootFolders
{
public string Path { get ; set ; }
public u long FreeSpace { get ; set ; }
public long FreeSpace { get ; set ; }
public List < UnmappedFolder > UnmappedFolders { get ; set ; }
}
@ -15,7 +15,7 @@ namespace NzbDrone.Core.RootFolders
RootFolder Add ( RootFolder rootDir ) ;
void Remove ( int id ) ;
List < UnmappedFolder > GetUnmappedFolders ( string path ) ;
Dictionary < string , u long> FreeSpaceOnDrives ( ) ;
Dictionary < string , long> FreeSpaceOnDrives ( ) ;
RootFolder Get ( int id ) ;
}
@ -99,9 +99,9 @@ namespace NzbDrone.Core.RootFolders
return results ;
}
public virtual Dictionary < string , u long> FreeSpaceOnDrives ( )
public virtual Dictionary < string , long> FreeSpaceOnDrives ( )
{
var freeSpace = new Dictionary < string , u long> ( ) ;
var freeSpace = new Dictionary < string , long> ( ) ;
var rootDirs = All ( ) ;