Experiencing this behavior both with standard Image fields and also with File Entity/Media "fields".

Upon feature activation and the node import process, for nodes containing these types of fields, each file is being duplicated multiple times. Furthermore, with File Entities, there are orphaned records being created in the db.

Interestingly, the number of dupes was only two per file with the Image field, but 4 per file with the File Entity field. :-/ Related to the number of module dependencies the feature module itself has??

CommentFileSizeAuthor
#10 1611928-fix-alt.patch4.07 KBtim-e
#10 interdiff.txt659 bytestim-e
#3 1611928.patch4.18 KBxtfer
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

laken’s picture

I am also seeing this on 7.x-1.0-alpha6+3-dev. Import of a node with a file field is creating 6 copies of the file! Interestingly, they are not all the same size:

-rw-r--r-- 1 6992412 Jul 12 16:53 freedom-fone.pdf
-rw-r--r-- 1 5244308 Jul 12 16:53 freedom-fone_0.pdf
-rw-r--r-- 1 6992412 Jul 12 16:53 freedom-fone_1.pdf
-rw-r--r-- 1 5244308 Jul 12 16:53 freedom-fone_2.pdf
-rw-r--r-- 1 6992412 Jul 12 16:53 freedom-fone_3.pdf
-rw-r--r-- 1 5244308 Jul 12 16:53 freedom-fone_4.pdf

The larger size files looks like the raw Base-64 encoded, the smaller is the actual PDF correctly decoded.

What is causing this?

himerus’s picture

Priority: Normal » Major

I've been experiencing this too on a new install (custom distribution) after attempting to import the content.

I'm getting upwards of 8 copies of each image. :( not good! Will see soon if I can dig to the bottom of why this is happening.

xtfer’s picture

Version: 7.x-1.0-alpha6 » 7.x-2.x-dev
Assigned: Unassigned » xtfer
Status: Active » Needs review
FileSize
4.18 KB

The file import handling seemed to be a little "experimental", so I have rewritten it. =)

This patch updates file handling so that files are created correctly and reused when they already exist (i.e. no duplicates).

It has been tested on a project containing several hundred file references to about 20 image and text files across 8 features, and seems to be working correctly.

Rolled against 2.x, as thats the version we are using, and it affects that module as well.

himerus’s picture

+1 for the patch in #3.

This fixes the issue in my install, including in a forked version of defaultcontent.

populist’s picture

Status: Needs review » Needs work

I tested the patch in #3 and it solves the initial problem of not duplicating images (my fresh install only generates one image file per image), but it will still duplicate files when the file already exists in the file system.

On quick glance, I think all we need to do to resolve this is to do a check to see if the file exists on the file system during the foreach loop this patch provides.

himerus’s picture

I did notice that it still did duplicate files after further testing on multiple installs, some wiping the file system, some not.

sylus’s picture

Has there been any progress on this? Can confirm this problem still exists.

Jeffrey C.’s picture

After there's a clean patch that solves the issue, I'll commit it.

Jeffrey C.’s picture

Meanwhile, please take a minute to check out #1869366: Future Plan.

tim-e’s picture

FileSize
659 bytes
4.07 KB

Found an issue with the patch in #3. It doesnt seem to add in the alt and title values.

Attached patch and interdiff.

Jeffrey C.’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review

All right. Anyone can test the patch?

xtfer’s picture

Assigned: xtfer » Unassigned
xtfer’s picture

Issue summary: View changes

derp

govind.maloo’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch is working fine
Also used in https://github.com/govCMS/govCMS
moving to RTBC