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...
Comment | File | Size | Author |
---|---|---|---|
#7 | 2064419-7.patch | 643 bytes | Owen Barton |
Comments
Comment #1
genjohnson CreditAttribution: genjohnson commentedI 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>
Comment #2
MMachnik CreditAttribution: MMachnik commentedI 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 :)
Comment #3
specky_rum CreditAttribution: specky_rum commentedI 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).
Comment #4
David_Rothstein CreditAttribution: David_Rothstein commentedPossibly this is the same issue as #2153851: When inserted into the WYSIWYG, links to files are duplicated when text surrounding them is manipulated?
Comment #5
David_Rothstein CreditAttribution: David_Rothstein commentedRestoring an issue component more like the original.
Comment #6
Owen Barton CreditAttribution: Owen Barton commentedI 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.
Comment #7
Owen Barton CreditAttribution: Owen Barton commentedHere is the chunk from that issue that fixes this for me.
Comment #8
Owen Barton CreditAttribution: Owen Barton commentedComment #9
bneil CreditAttribution: bneil commentedOwen,
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?
Comment #10
adam-delaney CreditAttribution: adam-delaney commentedI 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:
I am using the following project versions:
Comment #11
adam-delaney CreditAttribution: adam-delaney commentedAfter 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.
Comment #12
euanfergusson CreditAttribution: euanfergusson commentedHi
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.
Comment #13
joseph.olstadHmm, is this reproducible on the media_dev distribution?
Comment #14
Sneakyvv CreditAttribution: Sneakyvv at Calibrate for Government of Flanders commentedI'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.
Comment #15
Sneakyvv CreditAttribution: Sneakyvv at Calibrate for Government of Flanders commentedAs 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.
Comment #16
Sneakyvv CreditAttribution: Sneakyvv at Calibrate for Government of Flanders commented