Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload via web interface of file with same name in different subfolders #10527

Closed
danielecarrazza opened this issue Aug 3, 2018 · 12 comments · Fixed by #14674
Closed

Upload via web interface of file with same name in different subfolders #10527

danielecarrazza opened this issue Aug 3, 2018 · 12 comments · Fixed by #14674
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files
Milestone

Comments

@danielecarrazza
Copy link

Steps to reproduce

  1. Create a folder structure like that:
    +subfolder001 (contain the file: filename.txt)
    +subfolder002 (contain the file: filename.txt)
    +subfolder003 (contain the file: filename.txt)
    +subfolder004 (contain the file: filename.txt)
    +subfolder005 (contain the file: filename.txt)

  2. Drag and drop the five folders at the same time into the nextcloud file area.

Expected behaviour

The five folder with the same structure copied without errors.

Actual behaviour

The files are not copied and the web interface remain blocked. It appens quite always also with just two folders.
NOTE: I have also tryed the same procedure in the official demo of nextcloud.com and it have the same behaviour.

Server configuration

Operating system: Debian 9

Web server: Nginx

Database: MariaDB

PHP version: 7.2

Nextcloud version: 13.0.5

Updated from an older Nextcloud/ownCloud or fresh install: Fresh install

Where did you install Nextcloud from: from git repository

Signing status:

Signing status

List of activated apps:

App list Tested also disabling all apps.

Nextcloud configuration:

Config report Default unmodified config

Are you using external storage, if yes which one: no external storage

Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

LDAP config no ldap

Client configuration

Browser: Tested with multiple browser chrome, firefox (not possible with edge because do not support folder upload)

Operating system:

Logs

Web server error log

Web server error log

Nothing appears in system logs.

Nextcloud log (data/nextcloud.log)

Nextcloud log Nothing appears in nextcloud logs also in debug

Browser log

Browser log
@danielecarrazza danielecarrazza changed the title Upload via web interface of file with same name in dieffernt subfolders Upload via web interface of file with same name in different subfolders Aug 3, 2018
@nextcloud-bot nextcloud-bot added bug stale Ticket or PR with no recent activity and removed stale Ticket or PR with no recent activity labels Aug 3, 2018
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #9263 (Error when uploading files via web), #2842 ([Files] Upload folders), #8583 (Errors when uploading large files via files drop), #8370 (strange mistake with drag end drop web file interfaces), and #3339 (Add activity entry for files uploaded via files drop).

@claushviid claushviid mentioned this issue Aug 3, 2018
@vincentbab
Copy link

I have the same bug. Chrome's console shows a javascript error:

Uncaught TypeError: Cannot read property 'done' of null
at HTMLInputElement. (merged-index.js?v=2d8458b8-3:1521)
at HTMLInputElement.dispatch (core.js?v=2d8458b8-3:3)
at HTMLInputElement.r.handle (core.js?v=2d8458b8-3:3)
at Object.trigger (core.js?v=2d8458b8-3:3)
at Object.a.event.trigger (core.js?v=2d8458b8-3:7)
at HTMLInputElement. (core.js?v=2d8458b8-3:3)
at Function.each (core.js?v=2d8458b8-3:2)
at a.fn.init.each (core.js?v=2d8458b8-3:2)
at a.fn.init.trigger (core.js?v=2d8458b8-3:3)
at e.(/apps/files/anonymous function).(anonymous function)._trigger (https://xxx/core/vendor/core.js?v=2d8458b8-3:13:10041)

@kesselb
Copy link
Contributor

kesselb commented Aug 8, 2018

Issue is coming from

this.id = 'web-file-upload-' + md5(path) + '-' + (new Date()).getTime();

Id of upload is generated from file name (without the folder) and getTime().

FolderA/test.txt => web-file-upload-1111-timestamp
FolderB/test.txt => web-file-upload-1111-timestamp

In some cases getTime() is the same which results in identical ids for files in FolderA and FolderB. When i replace getTime with Math.random i cannot reproduce the issue anymore.

Owncloud had a similar issue. Is this true for nextcloud too?

image

I think relativePath + fileName + Math.random should prevent the identical ids.

@claushviid
Copy link

hello danielkesselberg

I tried to change the line to Math.random() i still got the same error again, but only with a lot more identical files not with a few identical files.
Regards claus Hviid

@kesselb
Copy link
Contributor

kesselb commented Aug 8, 2018

Does it work when you change to code like in the picture? I added this.getFile().relativePath before this.getFile().name

@claushviid
Copy link

claushviid commented Aug 8, 2018

no, it still does not work.
Here's a link with the files I'm trying with.

https://nextcloud1.claushviid.dk/s/jqekqbqq6R2ZC5y

The only way I could get the files copied into Nextcloud is via Flowupload

OC.FileUpload = function(uploader, data) {
this.uploader = uploader;
this.data = data;
var path = '';
if (this.uploader.fileList) {
path = OC.joinPaths(this.uploader.fileList.getCurrentDirectory(), this.getFile().relativePath + this.getFile().name);
} else {
path = this.getFile().relativePath + this.getFile().name;
}
this.id = 'web-file-upload-' + md5(path) + '-' + Math.random();

@claushviid
Copy link

Hmmm... today it is working with the changes made by danielkesselberg ????

@danielecarrazza
Copy link
Author

danielecarrazza commented Aug 15, 2018

I have just tried to swap the function with the one of NC "twin brother" and it work perfectly. I have no time now investigate better but this could be the way to check the origin of the bug.

@Marc-Whiteman
Copy link

I have the same bug. Chrome's console shows a javascript error:

Uncaught TypeError: Cannot read property 'done' of null
at HTMLInputElement. (merged-index.js?v=2d8458b8-3:1521)
at HTMLInputElement.dispatch (core.js?v=2d8458b8-3:3)
at HTMLInputElement.r.handle (core.js?v=2d8458b8-3:3)
at Object.trigger (core.js?v=2d8458b8-3:3)
at Object.a.event.trigger (core.js?v=2d8458b8-3:7)
at HTMLInputElement. (core.js?v=2d8458b8-3:3)
at Function.each (core.js?v=2d8458b8-3:2)
at a.fn.init.each (core.js?v=2d8458b8-3:2)
at a.fn.init.trigger (core.js?v=2d8458b8-3:3)
at e.(/apps/files/anonymous function).(anonymous function)._trigger (https://xxx/core/vendor/core.js?v=2d8458b8-3:13:10041)

I'm seeing this error as well, but only with Windows clients if that helps any.

@Lartza Lartza added 0. Needs triage Pending check for reproducibility or if it fits our roadmap feature: files labels Jan 2, 2019
@Lartza
Copy link
Member

Lartza commented Jan 2, 2019

This issue is still happening on 15.0.0, regardless of browser

@kesselb
Copy link
Contributor

kesselb commented Jan 2, 2019

@Lartza i was unsure about my solution and never setup a pull request for it. there were reports that this fix for owncloud (https://github.com/owncloud/core/pull/29393/files) solve the issue as well. had troubles to adopt the fix from owncloud for nextcloud. I guess we could as @skjnldsv @juliushaertl for some advice.

@hottwister
Copy link

hottwister commented Mar 13, 2019

Seems this changes in /apps/files/js/file-upload.js works for me

OC.FileUpload = function(uploader, data) {
this.uploader = uploader;
this.data = data;
// var path = '';
var basePath = '';
if (this.uploader.fileList) {
// path = OC.joinPaths(this.uploader.fileList.getCurrentDirectory(), this.getFile().name);
// } else {
// path = this.getFile().name;
basePath = this.uploader.fileList.getCurrentDirectory();
}
var path = OC.joinPaths(basePath, this.getFile().relativePath || '', this.getFile().name);
this.id = 'web-file-upload-' + md5(path) + '-' + (new Date()).getTime();
};

Need more tests)

ps don't foget clear client's browser cache

evilham added a commit to CamilionEU/nextcloud-server that referenced this issue Mar 13, 2019
This fixes collisions that were causing uploads to break in a very
terrible way.

Kudos to @kesselb for finding the problematic place and to
@hottwister for the proposed solution.

Fixes nextcloud#10527.
@MorrisJobke MorrisJobke added this to the Nextcloud 16 milestone Mar 20, 2019
backportbot-nextcloud bot pushed a commit that referenced this issue Mar 20, 2019
This fixes collisions that were causing uploads to break in a very
terrible way.

Kudos to @kesselb for finding the problematic place and to
@hottwister for the proposed solution.

Fixes #10527.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap bug feature: files
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants