Jump to content


Photo

Drag 'n drop uploading generates duplicate files

bug

  • Please log in to reply
10 replies to this topic

#1 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,519 posts
  • 845

  • LocationVihti, Finland

Posted 08 May 2012 - 02:57 AM

I recently updated to latest PW and it seems to have introduced one bug: when drag 'n dropping files it doubles the file and starts immediately two upload bars. I tried to figure out which is causing this behavior, but couldn't figure out.

#2 Soma

Soma

    Hero Member

  • Moderators
  • 3,186 posts
  • 1739

  • LocationSH, Switzerland

Posted 08 May 2012 - 03:45 AM

I can't reproduce this. Latest PW. Normal image field. Upload 1 or 2 images, no luck.

@somartist | modules created | support me, flattr my work flattr.com


#3 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,519 posts
  • 845

  • LocationVihti, Finland

Posted 08 May 2012 - 06:22 AM

Strange. I have double checked that this isn't browser cache issue or something like that. I have multiple sites having this issue currently (I have /wire/ as symlink, I test with few sites and if all runs correctly I update all our sites). Also tested with multiple browsers and users.

I will test this more later on. There is nothing too special running on those sites. For some reason js file posts two times when files are dropped.

Or have there been index.php update required or something like that?

#4 diogo

diogo

    Hero Member

  • Moderators
  • 1,982 posts
  • 1061

  • LocationPorto, Portugal

Posted 08 May 2012 - 07:49 AM

I was able to reproduce this, and did some tests.

The duplication happened on the same page, but only for the "images" field that came on the original install... didn't happen for a image field that i created later.
I created two more fields, one cloned from the original "images" and a new one with the default settings.
Then, I created a new template, and populated it with all the four fields -- the two from the first test, and the newly created ones.
On a new page with this template, the duplication happened on both, the "images" field and its clone (!), and not on the other two.
Also, it only happened to files bigger than approximately 17KB.

edit: tested with jpg, png and gif. they all behaved the same way

#5 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,519 posts
  • 845

  • LocationVihti, Finland

Posted 08 May 2012 - 08:01 AM

Thanks diogo! I hope I can test more today too (super busy atm).

#6 Soma

Soma

    Hero Member

  • Moderators
  • 3,186 posts
  • 1739

  • LocationSH, Switzerland

Posted 08 May 2012 - 08:12 AM

I tried on different computers and different browsers and installs. I'm still not able to reproduce this.

@somartist | modules created | support me, flattr my work flattr.com


#7 diogo

diogo

    Hero Member

  • Moderators
  • 1,982 posts
  • 1061

  • LocationPorto, Portugal

Posted 08 May 2012 - 08:14 AM

The problem is on the "Display thumbnails in page editor" option.

I looked for what was different in the original "images" field, and the ones that I just created, and this was one of those things. I tested all of them with and without the option checked, and it does make the difference.

#8 ryan

ryan

    Hero Member

  • Administrators
  • 5,771 posts
  • 3107

  • LocationAtlanta, GA

Posted 08 May 2012 - 08:30 AM

I was able to duplicate this. The problem was the recently introduced version numbers that are appended to $config->scripts (and $config->styles). InputfieldImage manually adds InputfieldFile.js to $config->scripts, as it always has. But it knows nothing about version numbers. The result was that if you had both a file and an image field on the same template, the same InputfieldFile.js would get included twice (one with version number, one without). All that JS in InputfiledFile.js would also execute twice when you dragged in a file. Thanks for finding this bug--I just committed a fix for this. I don't want to have to append version numbers ever time I manually add a script/style from a module, so I setup PW to ensure uniqueness of these at the time they are added (regardless of version number). I'm not yet sure why the display thumbnails option would make a difference here, but will experiment more. Please let me know if you find any issues remain.

Thanks,
Ryan

#9 Soma

Soma

    Hero Member

  • Moderators
  • 3,186 posts
  • 1739

  • LocationSH, Switzerland

Posted 08 May 2012 - 08:39 AM

Now I could reproduce it, thanks to Ryan. The trick was to add a file field to the template too. Display thumbnails option doesn't change anything.

@somartist | modules created | support me, flattr my work flattr.com


#10 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,519 posts
  • 845

  • LocationVihti, Finland

Posted 08 May 2012 - 08:46 AM

That was it - works now. Thanks for the quick fix Ryan.

#11 diogo

diogo

    Hero Member

  • Moderators
  • 1,982 posts
  • 1061

  • LocationPorto, Portugal

Posted 08 May 2012 - 09:35 AM

Ryan, forget the thumbnails thing... my testings where based on a very silly mistake.
I assumed the 0x100 created for the thumbnail were the duplicated file that was appearing to Antti. Next time I will also check the names of the files, instead of just glancing at the thumbnails of the file manager :S

I realized this right after I left for lunch, and was going to post as soon as I would come back to the computer. Glad you found out the problem before...





Also tagged with one or more of these keywords: bug

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users