Skip to content

Commit 0d704ab

Browse files
MediaController > Upload should only request permission for Media.Upload else the editor template Media isn't usable in the frontend
1 parent ba66b2b commit 0d704ab

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/Presentation/SmartStore.Web/Administration/Controllers/MediaController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
namespace SmartStore.Admin.Controllers
1717
{
18-
[AdminAuthorize]
1918
public class MediaController : AdminControllerBase
2019
{
2120
private readonly IMediaService _mediaService;
@@ -116,6 +115,7 @@ public async Task<ActionResult> Upload(string path, string[] typeFilter = null,
116115
}
117116

118117
//[ChildActionOnly]
118+
[AdminAuthorize]
119119
[HttpPost]
120120
public ActionResult FileConflictResolutionDialog()
121121
{
@@ -127,6 +127,7 @@ public ActionResult FileConflictResolutionDialog()
127127
return PartialView();
128128
}
129129

130+
[AdminAuthorize]
130131
public ActionResult MoveFsMedia()
131132
{
132133
var count = DataMigrator.MoveFsMedia(Services.DbContext);

src/Presentation/SmartStore.Web/Views/Shared/EditorTemplates/Media.cshtml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@
3131
}
3232
}
3333

34+
private DuplicateFileHandling DuplicateFileHandling
35+
{
36+
get
37+
{
38+
return GetMetadata<DuplicateFileHandling?>("duplicateFileHandling") ?? DuplicateFileHandling.ThrowError;
39+
}
40+
}
41+
3442
private string TypeFilter
3543
{
3644
get
@@ -117,7 +125,7 @@
117125

118126
<div class="fu-controls">
119127
@(Html.SmartStore().FileUploader()
120-
.UploadUrl(Url.Action("Upload", "Media", new { isTransient = TransientUpload, path = Path, area = "Admin" }))
128+
.UploadUrl(Url.Action("Upload", "Media", new { isTransient = TransientUpload, path = Path, area = "Admin", duplicateFileHandling = DuplicateFileHandling }))
121129
.Path(Path)
122130
.TypeFilter(TypeFilter)
123131
.ShowRemoveButton(!MultiFile && Model.HasValue) // Multifile uploads don't need a remove button.

0 commit comments

Comments
 (0)