diff --git a/KInspector.Modules/Modules/Content/DBFileConsistencyModule.cs b/KInspector.Modules/Modules/Content/DBFileConsistencyModule.cs index ec76b26c..d2f46b97 100644 --- a/KInspector.Modules/Modules/Content/DBFileConsistencyModule.cs +++ b/KInspector.Modules/Modules/Content/DBFileConsistencyModule.cs @@ -16,8 +16,6 @@ public ModuleMetadata GetModuleMetadata() { Name = "Form Attachments and Media Library Consistency Check", SupportedVersions = new[] { - new Version("6.0"), - new Version("7.0"), new Version("8.0"), new Version("8.1"), new Version("8.2"), @@ -368,14 +366,21 @@ public static FileInfo[] GetFiles(string baseUri, bool recursive, IInstanceInfo throw new ArgumentNullException($"baseUri value is null"); } - if(baseUri.StartsWith("~/")) + try + { + if(baseUri.StartsWith("~/")) + { + var absPath = Combine(info.Directory.FullName, baseUri.Substring(2)); + return Directory.Exists(absPath) ? new DirectoryInfo(absPath).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) : new FileInfo[] { }; + } + else + return Directory.Exists(baseUri) ? new DirectoryInfo(baseUri).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly) : new FileInfo[] { }; + } + catch(Exception ex) { - var absPath = Combine(info.Directory.FullName, baseUri.Substring(2)); - return new DirectoryInfo(absPath).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); + throw ex; } - else - return new DirectoryInfo(baseUri).GetFiles("*", recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); - } + } /// /// Combines a base url with a list of folders afterwards. diff --git a/KInspector.Modules/Scripts/GetLibraryAndAttachmentFiles.sql b/KInspector.Modules/Scripts/GetLibraryAndAttachmentFiles.sql index 5f747ef5..7f02a5bd 100644 --- a/KInspector.Modules/Scripts/GetLibraryAndAttachmentFiles.sql +++ b/KInspector.Modules/Scripts/GetLibraryAndAttachmentFiles.sql @@ -56,6 +56,6 @@ select @sql = @sql + 'Select [' + columnname + '] as AttachmentGUID, ' + siteID --remove the trailing 'union' -Select @sql = substring(@sql, 1, len(@sql) - 6) +Select @sql = CASE WHEN len(@sql) - 6 >= 0 THEN substring(@sql, 1, len(@sql) - 6) ELSE 'Select top 0 newid() as AttachmentGUID, 0 as SiteID, '''' as TableName' END exec (@sql) \ No newline at end of file