Hi everyone,
because of reasons we have attachments that are encrypted twice. We can handle this Problem using a DocumentAfterRepositoryLoadEvent.
But we want to clean up the attachments and ensure that all attachments are only encrypted once.
So the idea was to write a migration. The Problem is that when we use the AttachmentService to load an attachment it is decrypted of course.
So is here a may to get an attachment as it is, without being preprocessed by the the listener.
Also it would be nice to be able to keep the id of the attachment instead of recreating the attachment and updating the document with the new id.
Is there a way to do this during migrations?
Hi @jens-cold-layer,
I’m Dinh from the Data Services team.
Regarding your question, “Is there a way to get an attachment as it is, without being preprocessed by the listener?,” Data Services primarily publishes events. I believe the encryption/decryption is your customization.
You can try disabling the encryption event listener, retrieving the attachment, and then saving it again.
Additionally, please review the Content Store API: ContentStoreService.class.
I hope this helps.
Hello @jens-cold-layer , I am a member of the Discourse team. I can see that there was a new response to your question on the Topic of the discussion. Do you find it helpful or should the question remain open?
Thanks ahead for your feedback and have a nice rest of the day!
Thanks for the information.
The Content Store API wasn’t that heplful. But we solved the problem by using a second ContentBeforeDownloadEvent Listener that is controlled by a condition. So that the listener is only active during the migration.