mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-26 20:16:15 +08:00
Fixing #17489: Authenticated user uploading the not allowed media donesn't have any error info [4569 (6cb6b7704f7c)]
--HG-- branch : 1.x
This commit is contained in:
@@ -198,7 +198,7 @@ namespace Orchard.Media.Controllers {
|
||||
Services.Notifier.Information(T("Media file(s) uploaded"));
|
||||
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
||||
} catch (Exception exception) {
|
||||
this.Error(exception, T("Uploading media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
this.Error(exception, T("Uploading media file failed:"), Logger, Services.Notifier);
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
@@ -196,14 +196,17 @@ namespace Orchard.Media.Services {
|
||||
return _storageProvider.GetPublicUrl(folderPath);
|
||||
}
|
||||
|
||||
if (FileAllowed(fileName, true)) {
|
||||
string filePath = _storageProvider.Combine(folderPath, fileName);
|
||||
_storageProvider.SaveStream(filePath, inputStream);
|
||||
if (!FileAllowed(fileName, true)) {
|
||||
var currentSite = _orchardServices.WorkContext.CurrentSite;
|
||||
var mediaSettings = currentSite.As<MediaSettingsPart>();
|
||||
|
||||
return _storageProvider.GetPublicUrl(filePath);
|
||||
throw new ArgumentException(T("Could not upload file {0}. Supported file types are {1}.", fileName, mediaSettings.UploadAllowedFileTypeWhitelist).Text);
|
||||
}
|
||||
|
||||
return null;
|
||||
string filePath = _storageProvider.Combine(folderPath, fileName);
|
||||
_storageProvider.SaveStream(filePath, inputStream);
|
||||
|
||||
return _storageProvider.GetPublicUrl(filePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user