diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index dc96283..aa58b5d 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -323,10 +323,13 @@ class CmsController < MyProfileController def media_upload parent = check_parent(params[:parent_id]) if request.post? - @file = UploadedFile.create(:uploaded_data => params[:file], :profile => profile, :parent => parent) unless params[:file] == '' + begin + @file = UploadedFile.create!(:uploaded_data => params[:file], :profile => profile, :parent => parent) unless params[:file] == '' + @file = FilePresenter.for(@file) + rescue Exception => exception + render :text => exception.to_s, :status => :bad_request + end end - @file = FilePresenter.for(@file) - #render :text => article_list_to_json([file]), :content_type => 'text/plain' end def published_media_items diff --git a/app/views/cms/_text_editor_sidebar.html.erb b/app/views/cms/_text_editor_sidebar.html.erb index 4cfe970..00dc506 100644 --- a/app/views/cms/_text_editor_sidebar.html.erb +++ b/app/views/cms/_text_editor_sidebar.html.erb @@ -30,7 +30,7 @@