Fix direct upload with a whitelist present that does not contain binary

pull/9790/head
Oliver Günther 3 years ago
parent b5bffe0f6d
commit 0ec9db6e96
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 2
      app/services/attachments/prepare_upload_service.rb
  2. 4
      modules/bim/app/controllers/bim/ifc_models/ifc_models_controller.rb

@ -27,7 +27,7 @@
#++
module Attachments
class PrepareUploadService < ::BaseServices::Create
class PrepareUploadService < BaseService
def persist(call)
attachment = call.result

@ -78,8 +78,8 @@ module Bim
attachment = Attachment.pending_direct_uploads.where(id: id).first
if attachment.nil? # this should not happen
flash[:error] = "Direct upload failed."
redirect_to action: :new
return
end
params = {
@ -179,7 +179,7 @@ module Bim
return unless OpenProject::Configuration.direct_uploads?
call = ::Attachments::PrepareUploadService
.new(user: current_user)
.bypass_whitelist(user: current_user)
.call(filename: "model.ifc", filesize: 0)
call.on_failure { flash[:error] = call.message }

Loading…
Cancel
Save