Re: Deleting one attachment

Thomas Oddsund <[email protected]>
Newsgroups gmane.comp.bug-tracking.request-tracker.user
Message-ID <[email protected]>
?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 <[email protected]> på vegne av Ram <[email protected]>
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

---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Boston - October 24-26
* Los Angeles - Q1 2017
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.