From 38939ab265056fea0ee4f2b8ccc836c9c4962f84 Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Thu, 2 Dec 2021 17:14:25 +0800 Subject: [PATCH 1/2] Output readable message when version does not exist --- .../Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index 20ebc4eb23..316e9e6e04 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -83,13 +83,16 @@ namespace Volo.Abp.Cli.ProjectBuilding version = latestVersion; } - var nugetVersion = (await GetTemplateNugetVersionAsync(name, type, version)) ?? version; + if (await GetTemplateNugetVersionAsync(name, type, version) == null) + { + throw new Exception("There is no version found with given version: " + version); + } if (!string.IsNullOrWhiteSpace(templateSource) && !IsNetworkSource(templateSource)) { Logger.LogInformation("Using local " + type + ": " + name + ", version: " + version); return new TemplateFile(File.ReadAllBytes(Path.Combine(templateSource, name + "-" + version + ".zip")), - version, latestVersion, nugetVersion); + version, latestVersion, version); } var localCacheFile = Path.Combine(CliPaths.TemplateCache, name.Replace("/", ".") + "-" + version + ".zip"); @@ -97,14 +100,14 @@ namespace Volo.Abp.Cli.ProjectBuilding #if DEBUG if (File.Exists(localCacheFile)) { - return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion, nugetVersion); + return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion, version); } #endif if (Options.CacheTemplates && File.Exists(localCacheFile) && templateSource.IsNullOrWhiteSpace()) { Logger.LogInformation("Using cached " + type + ": " + name + ", version: " + version); - return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion, nugetVersion); + return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion, version); } Logger.LogInformation("Downloading " + type + ": " + name + ", version: " + version); @@ -125,7 +128,7 @@ namespace Volo.Abp.Cli.ProjectBuilding File.WriteAllBytes(localCacheFile, fileContent); } - return new TemplateFile(fileContent, version, latestVersion, nugetVersion); + return new TemplateFile(fileContent, version, latestVersion, version); } private async Task GetLatestSourceCodeVersionAsync(string name, string type, string url = null, From c4efe363e3e0735f9146dc2e64bb23e73203c511 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 2 Dec 2021 17:15:30 +0800 Subject: [PATCH 2/2] Add `FormBodyBindingIgnoredTypes` in `WebModule`. --- .../blogging/src/Volo.Blogging.Web/BloggingWebModule.cs | 7 +++++++ .../src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs index 3e44b651ec..3a80ce21d0 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; @@ -11,6 +12,7 @@ using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; using Volo.Blogging.Bundling; +using Volo.Blogging.Files; using Volo.Blogging.Localization; namespace Volo.Blogging @@ -78,6 +80,11 @@ namespace Volo.Blogging { options.DisableModule(BloggingRemoteServiceConsts.ModuleName); }); + + Configure(options => + { + options.ConventionalControllers.FormBodyBindingIgnoredTypes.Add(typeof(FileUploadInputDto)); + }); } } } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs index 549e200aae..97b7cbe2fb 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/CmsKitAdminWebModule.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc; using Volo.CmsKit.Admin.Web.Menus; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.Modularity; @@ -12,6 +13,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.PageToolbars; using Volo.Abp.Localization; using Volo.Abp.AutoMapper; using Volo.Abp.Http.ProxyScripting.Generators.JQuery; +using Volo.CmsKit.Admin.MediaDescriptors; namespace Volo.CmsKit.Admin.Web { @@ -158,6 +160,11 @@ namespace Volo.CmsKit.Admin.Web { options.DisableModule(CmsKitAdminRemoteServiceConsts.ModuleName); }); + + Configure(options => + { + options.ConventionalControllers.FormBodyBindingIgnoredTypes.Add(typeof(CreateMediaInputWithStream)); + }); } } }