We've noticed files overwriting themselves on migration. If you're importing two files, one named a/1.jpg and another named b/1.jpg, the basename() for both these are 1.jpg even though they are different files in different directories. I'm wondering if in plugins/destinations/fields.inc+190, if we should (a) just pass the $full_path to file_stream_wrapper_uri_normalize() or (b) further make the name unique by changing basename($full_path) to str_replace('/', '-', $full_path). Is this the right place to fix the problem and if so, which solution do you like?

CommentFileSizeAuthor
#4 migrate-fields.patch787 bytesdouggreen

Comments

moshe weitzman’s picture

I've fiddled with this code a lot trying to make all the file_move, file_copy, and file_save cases work properly. chx just changed it some more. At this point, I'm not quite sure whats needed. We need some tests here for sure. At first blush, that str_replace looks good.

MashMeisterD’s picture

Moshe - not fully vetted but am seeing properly created nodes and images that were once dupes overwriting each other now creating new fids. Will do a few more tests but so far looks good. Was a significant issue so hope this is a good fix. Would appreciate a review for any gotchas we may be missing.

mikeryan’s picture

Project: Migrate » Migrate Extras
Component: Code » Filefield
Status: Needs review » Active

Filefield handling has moved to Migrate Extras, and has changed a bit since the move.

douggreen’s picture

Status: Active » Needs review
StatusFileSize
new787 bytes

Sorry, I thought I uploaded a patch with this...

mikeryan’s picture

Project: Migrate Extras » Migrate
Component: Filefield » Code
Assigned: Unassigned » mikeryan

It moved back to Migrate a while ago.

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.