Content
Handling attachments as external URLs
Added by Jerome C almost 8 years ago
Hello,
I was having a discussion with ‘support’ regarding attachments.
The problem is that any attachment added to a task is a second version, the first being handled by a document management system/tool/protocol (which OpenProject should not substitute). As the document could be dynamic in nature, this forces a manual update of TWO object. Major source of errors…. 10-foot pole type of situation…
I was told ‘well it’s not on the roadmap, but since it is open source…’ So I cloned the most recent dev release and started exploring. The solutions that appear evident to me are apparently already there:
• AttachmentsController has an action method with `url = @attachment.external_url`
• class Attachment defines method `external_url`
• the documentation at `https://github.com/opf/openproject/blob/dev/doc/CONFIGURATION.md#attachments-storage` provides the fog parameter setting.
So, how are these not accessible with OpenProject’s hosted service?
I realize there are no views for this functionality (nor have I found any for inputting some some S3 settings). Also the PlanningElementsController create action only contemplates `@planning_element.attach_files(params[:attachments])`
Is there a conscious reason for this?
Replies (2)
Hi Jerome,
we’re using CarrierWave for handling uploads, and by default a FileUploader is used to store your attachments locally.
You can define a S3 bucket for uploading files instead by passing
fog_credentials
, see the documentation from Carrierwave.These settings are read during the boot of the application in
config/initializers/carrierwave.rb
.The method
attach_files
then creates an attachment model instance which in turn uses the uploader throughmount_uploader
.Best,
Oliver
Yes Oliver,
this is exactly what I was hoping for (I saw the carrierwave initializer in the ce version, not the dev version) and surmised this was an avenue. In addition, we could define a
class FileUploader < CarrierWave::Uploader::Base
to store the objects in rigorous manner.However, how could this be applied to an openproject.com hosted solution? I find no UI that alludes to it…
[thank you for quick turnover on comment]
Jerome