View Issue Details

IDProjectCategoryView StatusLast Update
0020018mantisbtattachmentspublic2016-08-15 09:02
Reporterbadfiles Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0 
Target Version1.2.20Fixed in Version1.2.20 
Summary0020018: Copied bug attachments have wrong ownership
Description

When an attachment is copied to a new bug, its metadata is copied partly.
There should be a reason not to copy user_id.

TagsNo tags attached.

Activities

dregad

dregad

2015-08-11 03:41

developer   ~0051224

We don't have a standalone function to copy attachments, are you referring to issue Cloning ?

badfiles

badfiles

2015-08-11 15:35

reporter   ~0051227

I mean function file_copy_attachments() of file_api

atrol

atrol

2015-08-11 17:02

developer   ~0051228

We should set user_id to the user who is creating the copy (not the user that added the original attachment)

Furthermore we should set date_added to the current date (we copy this information from original attachment at the moment)

dregad

dregad

2015-08-12 11:37

developer   ~0051236

Last edited: 2015-08-12 11:44

PR for review https://github.com/mantisbt/mantisbt/pull/630

For the record, this problem exists also in 1.2.x branch, so the fix should probably be backported.

dregad

dregad

2015-08-13 04:27

developer   ~0051242

Following the proposed implementation following atrol's suggestion in 0020018:0051228, a discussion took place in the pull request. Maybe a more targeted fix just correcting the erroneous behavior as reported by badfiles is the better way to go.

dregad

dregad

2015-08-13 12:06

developer   ~0051252

Sorry about that, I inadvertantly pushed to mantisbt instead of my own fork.

dregad

dregad

2015-08-13 12:14

developer   ~0051253

Last edited: 2015-08-13 12:18

PR, take 2 https://github.com/mantisbt/mantisbt/pull/632

Roland, as per the discussion in the previous PR and since you were the one proposing the change in behavior, I let you open another issue to track and discuss it (as per vboctor's suggestion) if you feel it's necessary.

dregad

dregad

2015-08-20 08:44

developer   ~0051294

Backported to 1.2.x

Related Changesets

MantisBT: master 8392a9b6

2015-08-13 07:51

dregad


Details Diff
Set bug attachment ownership when copying them

file_copy_attachments() did not set user_id when inserting the new
attachment, resulting in that field being set to 0.

The user_id is now set to the original issue's.

Fixes 0020018
Affected Issues
0020018
mod - core/file_api.php Diff File

MantisBT: master-1.2.x aa652758

2015-08-13 07:51

dregad


Details Diff
Set bug attachment ownership when copying them

file_copy_attachments() did not set user_id when inserting the new
attachment, resulting in that field being set to 0.

The user_id is now set to the original issue's.

Fixes 0020018

Backport from master 8392a9b67f9c897849395d42a131fb979f45148f.
Affected Issues
0020018
mod - core/file_api.php Diff File