Fix IFC direct upload callback failing on non-standard store paths

attachment_id_from_key used a regex anchored to `uploads/` which does
not match store paths on SaaS instances where the store_dir is
overridden with an instance-specific prefix (e.g. instance_qa_bim/...).

https://community.openproject.org/projects/STB/work_packages/STB-80/activity
This commit is contained in:
Oliver Günther
2026-06-10 10:28:44 +02:00
parent dc4cd9a6b4
commit efc7a8afb6
@@ -78,7 +78,7 @@ module Bim
end
def direct_upload_finished # rubocop:disable Metrics/AbcSize,Metrics/PerceivedComplexity
attachment_id = attachment_id_from_key(request.params[:key])
attachment_id = session[:pending_ifc_model_attachment_id]
unless callback_context_valid?(attachment_id)
fail_direct_upload
return
@@ -264,10 +264,6 @@ module Bim
actual_payload == expected_payload
end
def attachment_id_from_key(key)
key.to_s.match(%r{\Auploads/[^/]+/file/(\d+)/[^/]+\z})&.captures&.first
end
def fail_direct_upload
flash[:error] = t("bim.error_direct_upload_failed")
redirect_to action: :new