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

Overwriting a file through webdav and killing the process the original file disappear #9302

Closed
javiergonzper opened this issue Jun 30, 2014 · 10 comments · Fixed by #9507
Closed
Assignees
Labels
Milestone

Comments

@javiergonzper
Copy link

Steps to reproduce

1- Upload a file using curl with the same name than other existing:
curl -X PUT -u username:password "https://XXXXXXXXX/owncloud/remote.php/webdav/Dia-0.97.2-7.dmg" -F myfile=@"/Users/Javi/Downloads/Dia-0.97.2-7.dmg"
2- Kill the process (ctrl+c)

Expected behaviour

The upload is canceled so the file is not upload and the existing file should still there.

Actual behaviour

The upload is canceled but the existing file disappear

Owncloud version:

{"installed":"true","version":"6.0.3.1","versionstring":"6.0.3","edition":"enterprise"}

Logs

I don’t see any logs related to this

@PVince81
Copy link
Contributor

I think there is code in the chunking routines that detect such cancelled calls, but I don't remember exactly what they do. They should actually only delete the chunks but not the original file.

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

It looks like I've got a similar issue in #9452: one upload failed because for some unknown reason the file size didn't match. And after that the file was actually moved to the trashbin and the sync client would get 412 precondition failed!

Needs further investigation.

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

@javiergonzper you should actually use -T file.xml for upload, else the upload file will only contain upload headers. But this doesn't affect the error itself.

Will try to reproduce this.

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

It looks like this code is executed too later, after the part file has been renamed already !
Also using fileView->unlink() will trigger the hooks, which means it will delete to trashbin...

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

Setting to OC 7 CE (with backport to 6.0.5) as loss of data is involved @karlitschek

@PVince81 PVince81 added this to the ownCloud 7 CE milestone Jul 7, 2014
@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

From what I see this code is only triggered when chunking is NOT involved.

@DeepDiver1975
Copy link
Member

as discussed: I'll have a look at this asap - most probably tomorrow

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2014

As discussed with @DeepDiver1975, he'll have a look.

The issue is that the "AbortedUploadDetectionPlugin" runs too late.
During the process, a part file is created, then renamed to the final file.
And only then the file size is checked.
If the file size is wrong, the final file is deleted...

It should actually check the size earlier, check it on the part file. And delete the part file if the size does not match.

Assigning to @DeepDiver1975

@rperezb
Copy link

rperezb commented Jul 7, 2014

On the iOS app, we are not using chunks any more because of the background feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants