[rt-users] Deleting one attachment

Thomas Oddsund thomas.oddsund at usit.uio.no
Tue Oct 25 10:31:52 EDT 2016


?Hello,


Sorry for not seeing this sooner, but I'll leave this for people wondering about the same in the future.

We have sucessfully deleted single attachments from a ticket using rt-shredder. Issue the command like this;

rt-shredder --plugin 'Objects=Attachment,<attachment-id>?'


We use RT 4.2.8.


Med vennlig hilsen,
Thomas Oddsund
SDS/USIT
________________________________
Fra: rt-users <rt-users-bounces at lists.bestpractical.com> på vegne av Ram <ram0502 at gmail.com>
Sendt: 25. oktober 2016 01:45
Til: rt-users
Emne: Re: [rt-users] Deleting one attachment

Inline..
> A user at work added an attachment that violates corporate policy to a
> ticket; the ticket itself is valid and must be kept. I need to delete the
> attachment. A quick look at the rt-shredder tool does not make it apparent
> to me how to do this with rt-shredder. I can readily do it editing the db in
> mysql but I'd rather use rt-shredder if it will do the job.
> any help?

I'll be going with a direct DB edit which I'm documenting here for the next person. Since I just want to suppress the file and do not want to hide the fact that it existed. Here is what I did, be very careful! If you don't know SQL or you don't understand every step below then find someone else to help you - this is the WRONG PATH for you:

1 Get the attachment id of the attachment to remove (as of RT 4.4.1  it's the *second* number in the URL that displays the attachment).

2 Add a comment to the ticket indicating that you are deleting the offending attachment for policy violation (or whatever you motive).

3 Run this command to improve your odds of not messing up and deleting the wrong transaction:
> select id, Transactionid, MessageId, Subject, Filename, ContentType, ContentEncoding, Headers, Creator, Created from Attachments where id= ATTACHMENT_ID_FROM_STEP_1 \G

4 If that looks right to you then run this SQL against A TEST COPY OF YOUR DB to ensure you are killing the right attachment
> update Attachments set Content = NULL where id = ATTACHMENT_ID_FROM_STEP_1 limit 1;

5 Go look at the ticket in RT and ensure that you did indeed eliminate the offending attachment.

6 Repeat steps 3,4,5 in your production environment.

7 Do not call me if you shot yourself in the foot. No warranty expressed or implied!

If this isn't perfectly clear, hire Best Practical (https://bestpractical.com/)  to do it for you.

cheers,

Ram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20161025/36648f63/attachment.htm>


More information about the rt-users mailing list