mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-26 20:16:15 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
@@ -233,16 +233,8 @@ namespace Orchard.Media.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult EditMedia(string name, DateTime lastUpdated, long size, string folderName, string mediaPath) {
|
||||
var model = new MediaItemEditViewModel();
|
||||
model.Name = name;
|
||||
// todo: reimplement
|
||||
//model.Caption = caption ?? String.Empty;
|
||||
model.LastUpdated = lastUpdated;
|
||||
model.Size = size;
|
||||
model.FolderName = folderName;
|
||||
model.MediaPath = mediaPath;
|
||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(mediaPath, name));
|
||||
public ActionResult EditMedia(MediaItemEditViewModel model) {
|
||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(model.MediaPath, model.Name));
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -293,9 +285,8 @@ namespace Orchard.Media.Controllers {
|
||||
mediaPath = viewModel.MediaPath });
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.Error(exception, T("Editing media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
|
||||
return View(viewModel);
|
||||
this.Error(exception, T("Editing media file failed."), Logger, Services.Notifier);
|
||||
return EditMedia(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,10 @@ namespace Orchard.Media.Services {
|
||||
Argument.ThrowIfNullOrEmpty(newFileName, "newFileName");
|
||||
|
||||
if (!FileAllowed(newFileName, false)) {
|
||||
throw new ArgumentException(T("New file name {0} is not allowed", newFileName).ToString());
|
||||
if (string.IsNullOrEmpty(Path.GetExtension(newFileName))) {
|
||||
throw new ArgumentException(T("New file name \"{0}\" is not allowed. Please provide a file extension.", newFileName).ToString());
|
||||
}
|
||||
throw new ArgumentException(T("New file name \"{0}\" is not allowed.", newFileName).ToString());
|
||||
}
|
||||
|
||||
_storageProvider.RenameFile(_storageProvider.Combine(folderPath, currentFileName), _storageProvider.Combine(folderPath, newFileName));
|
||||
|
||||
Reference in New Issue
Block a user