mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +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"));
|
Services.Notifier.Information(T("Media file(s) uploaded"));
|
||||||
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
||||||
} catch (Exception exception) {
|
} 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);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,14 +196,17 @@ namespace Orchard.Media.Services {
|
|||||||
return _storageProvider.GetPublicUrl(folderPath);
|
return _storageProvider.GetPublicUrl(folderPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileAllowed(fileName, true)) {
|
if (!FileAllowed(fileName, true)) {
|
||||||
string filePath = _storageProvider.Combine(folderPath, fileName);
|
var currentSite = _orchardServices.WorkContext.CurrentSite;
|
||||||
_storageProvider.SaveStream(filePath, inputStream);
|
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>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user