Scenario: use media browser to attempt to embed multiple files into same WYSIWYG one at a time. Then disable rich-text and observe that all the instances have the same fid even though they were different files.

Sample code:

<p>[[{"fid":"62","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{"class":"file media-element file-default"},"link_text":"ScreenFlow.avi"}]]</p><p>[[{"fid":"62","view_mode":"default","fields":{"format":"default"},"type":"media","attributes":{"class":"file media-element file-default"},"link_text":"Untitled.mov"}]]</span></p>

First file in this case was an AVI and second a MOV, but I haven't noticed a difference based on file type. It always seems to happen. Checked media 1.x and did not see this occur there.

If you go ahead and save the node and then view it, you see the two links each with the correct link text, but the URL of the first one gets repeated for the second one (and others if > 2), presumably because the file ID stored in the field is the first one repeated for each file you attempted to add.

Thanks...

CommentFileSizeAuthor
#7 2064419-7.patch643 bytesOwen Barton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

genjohnson’s picture

Status: Active » Closed (cannot reproduce)

I am not able to reproduce this issue.

I embedded multiple files into the WYSIWYG, and when I disable rich-text the fid's are unique as expected.

<p>[[{"fid":"1","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":"","media_description[und][0][value]":"","field_tags[und]":""},"type":"media","link_text":"Druplicon.large.png","attributes":{"class":"file media-element file-default"}}]]</p><p>[[{"fid":"2","view_mode":"default","fields":{"format":"default","media_description[und][0][value]":"","field_tags[und]":""},"type":"media","link_text":"MediaGallery.mp4","attributes":{"class":"file media-element file-default"}}]]</p><p>[[{"fid":"3","view_mode":"default","fields":{"format":"default","media_description[und][0][value]":"","field_tags[und]":""},"type":"media","link_text":"TheDrupalSong.mp3","attributes":{"class":"file media-element file-default"}}]]</p><p>[[{"fid":"4","view_mode":"default","fields":{"format":"default","field_file_image_alt_text[und][0][value]":"","field_file_image_title_text[und][0][value]":"","media_description[und][0][value]":"","field_tags[und]":""},"type":"media","link_text":"tux.png","attributes":{"class":"file media-element file-default"}}]]</p>

MMachnik’s picture

Status: Closed (cannot reproduce) » Active

I have more information I hope will help. :) Further testing shows that the problem does not occur in Firefox, where it worked with both the Aug 1 dev release and the recently released alpha. But I did see it in both on Chrome (where I initially saw it), IE 9 and Safari.

Javascript debugging in Chrome showed some weirdness with Drupal.settings.tagmap, it contained multiple references to the same file even though different files were embedded, so this may be the source of the problem.

To confirm that this was not a side effect of anything in the project where I discovered this, I also reproduced it with a fresh install of 7.23, 2.0 alpha 1 of media and file_entity, wysiwyg 7.x-2.2 and TinyMCE 3.4.4, as well as ctools, views and admin_menu.

(edit) Also, this is using the private file system, though I haven't found yet if that makes a difference.

Hope this helps -- thanks :)

specky_rum’s picture

I was seeing the same issue as this, in FF too. Applying the patch from here: https://drupal.org/node/2126755 fixes it except for the case where the same file is added to a page more than once (see my comment).

David_Rothstein’s picture

Component: WYSIWYG integration » Code
Issue summary: View changes
David_Rothstein’s picture

Component: Code » Media WYSIWYG

Restoring an issue component more like the original.

Owen Barton’s picture

I noticed that #2177893: Custom wrapper breaks tokens with CKEditor >=4.0 without widget plugin appeared to fix this for me - I haven't investigated how yet, but it might provide a clue.

Owen Barton’s picture

FileSize
643 bytes

Here is the chunk from that issue that fixes this for me.

Owen Barton’s picture

Status: Active » Needs review
bneil’s picture

Status: Needs review » Postponed (maintainer needs more info)

Owen,

It looks like that fix in #7 was committed in #2328493: Async behavior of wysiwyg plugin attach/detach leads to some media tags not being replaced in time - can you try the latest dev and see if this issue has been resolved?

adam-delaney’s picture

I can confirm this issue. My test case was to add multiple document files in an unordered list. Sometimes I the documents will be placed properly and other times the file IDs are duplicated. Steps to re-create the issue:

  1. Create an unordered list
  2. Add a document
  3. Add another document
  4. Put your cursor at the end of the 1st document li
  5. Create a new list item under this by hitting return
  6. Add another document in between the 1st and last

I am using the following project versions:

  • File Entity: 7.x-2.x-dev
  • Media: 7.x-2.x-dev
  • WYSIWYG: 7.x-2.x-dev
  • CKeditor library 4.4.6.08188c4
adam-delaney’s picture

After a little more investigation this could be related to another issue in Media. I have tried the latest patch over at issue #2028231 and it helped resolves the issue I was having with duplicate file IDs.

euanfergusson’s picture

Hi

I am still experiencing this issue with 7.x-2.13.

I am only able to replicate it in a Windows / Mac environment. Site works correctly using FF on Ubuntu.

joseph.olstad’s picture

Hmm, is this reproducible on the media_dev distribution?

Sneakyvv’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Needs work

I'm also still experiencing this issue with 7.x-2.16 using Chrome on Mac, but also in FF. The problem is even worse, because of this scenario.

1) create page with some text and a file in a wysiwyg field
2) edit the page
3) add some text to the bottom, multiple paragraphs
4) add a new file (upload) via media browser

=> all lines of text are replaced with a media wysiwyg token referencing the fid of the first file.

So, input is lost! Therefor I'm bumping this issue up to major.

Sneakyvv’s picture

Priority: Major » Normal
Status: Needs work » Closed (duplicate)

As David_Rothstein suggested this is indeed a duplicate of #2153851: When inserted into the WYSIWYG, links to files are duplicated when text surrounding them is manipulated, or at least I believe the cause is the same. Since the TinyMCE script is duplicating the parent span, any file span which is nested within that duplicated span is ignored. I have uploaded a patch there. I'm marking this as duplicate, and lowering it back to normal since the lost data is "only" that which is being added, no already existing data. Also not ok, obviously, but perhaps not a "major" deal.