Skip to content

Use Webdav PUT for uploads#21237

Merged
PVince81 merged 6 commits into
masterfrom
files-ui-webdav-upload
Sep 6, 2016
Merged

Use Webdav PUT for uploads#21237
PVince81 merged 6 commits into
masterfrom
files-ui-webdav-upload

Conversation

@PVince81

@PVince81 PVince81 commented Dec 16, 2015

Copy link
Copy Markdown
Contributor

Fixes #4380

  • send mtime with upload (bonus feature!)
  • conflict handling
    • replace file after conflict resolution
    • autorename
    • abort
  • error cases
    • parent folder does not exist any more
  • folder upload
  • highlight all files after upload (code currently discarded)
  • make ajax/upload.php as close as possible to webdav upload (for IE8 to reduce code paths)
  • Webdav plugin for iframe transport
  • delete ajax/upload.php
  • clean up messy code (a bit)
  • unit tests
    • file list
    • PHP side
    • file-upload.js

Test cases

  • TEST: create file from menu + error cases
  • TEST: create folder from menu + error cases
  • TEST: upload files into current folder
  • TEST: upload files into a subfolder
  • TEST: upload files to breadcrumb
  • TEST: upload folder with multiple subdirs (Chrome only)
  • TEST: upload file/folder into a subfolder that does not exist (renamed/deleted concurrently)
  • TEST: cancel upload
  • TEST: conflict dialog
    • TEST: autorename
    • TEST: overwrite
    • TEST: don't overwrite
  • TEST: in all modern browsers
  • TEST: IE8 😱
  • TEST: all upload scenarios in public page (with and without password)
  • TEST: special characters

@PVince81 PVince81 self-assigned this Dec 16, 2015
@PVince81 PVince81 added this to the 9.0-current milestone Dec 16, 2015
@mention-bot

Copy link
Copy Markdown

By analyzing the blame information on this pull request, we identified @butonic, @pdessauw and @schiesbn to be potential reviewers

Comment thread apps/files/js/file-upload.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really? 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops

Comment thread apps/files/js/file-upload.js Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eeergh

@PVince81 PVince81 force-pushed the files-ui-webdav-upload branch from cb4467a to 9feacc4 Compare December 17, 2015 21:12

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DeepDiver1975 @evert is this acceptable or have a gone too far 😉

I wanted to replace the old ajax/upload.php and use Webdav PUT for uploads.
However old browsers like IE8/IE9 need an iframe transport and do a POST, so this plugin catches that and forwards the call to createFile / updateFile and checks preconditions.

Goal is to bring the code paths as close as possible.

What do you think ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also @LukasReschke in case of security considerations. I added the CSRF check here, but we can probably move it to a generic plugin or the auth plugin.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't really see anything wrong with it. You could even take it one step further by creating a $subRequest / $subResponse and sending that to Server::invokeMethod as a more generic approach.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! That's the kind of thing I was looking for 😄 Thanks!
Problem though is that I need to post-process the response to repackage it as JSON.
I'll have a look if that's possible.

@PVince81

Copy link
Copy Markdown
Contributor Author

Will do autorename using Webdav POST on the collection with suggested name, as per RFC 5995 http://greenbytes.de/tech/webdav/rfc5995.html (starting to like that one!)

@PVince81

Copy link
Copy Markdown
Contributor Author

And here we go, autorename implemented based on RFC 5995. So cool!

  • BUG: conflict dialog must appear at the end of all transfers not a regression, something for another time (it behaved like this in OC7 too)

@PVince81 PVince81 force-pushed the files-ui-webdav-upload branch from 96e9454 to ef903f4 Compare December 21, 2015 14:48
@PVince81

Copy link
Copy Markdown
Contributor Author

I'm still wondering whether it's ok to have all these extra PROPFIND after upload, or whether we should try and return all the needed info through headers...

@PVince81

Copy link
Copy Markdown
Contributor Author

Here are some ideas to remove the extra PROPFIND on after upload:

  • get fileid from headers
  • get etag from headers
  • mtime? if accepted => use sent one, else set to now
  • size? use one if browser knows it, else need to return as header
  • share/tags info => not really needed or can be computed
  • mimetype ? could be problematic, unless we return it too...
  • permissions: compute ?
  • mount type: compute ?

@PVince81

Copy link
Copy Markdown
Contributor Author

Would be even easier if we could just return a JSON blob (or the result of XML PROPFIND) as a result of the PUT request.
@evert would that violate any Webdav convention ?

@evert

evert commented Dec 21, 2015

Copy link
Copy Markdown

I don't think there's any problems with doing stuff with the response to a PUT request. It's a bit unusual

@PVince81 PVince81 force-pushed the files-ui-webdav-upload branch from ef903f4 to 5e88bef Compare December 21, 2015 18:07
@PVince81

Copy link
Copy Markdown
Contributor Author

@evert so I guess it might be better to return information as headers instead ? That's what we party did so far: OC-FileId contains the file id and OC-Mtime: accepted tells whether the server accepted the mtime. We could add OC-Permissions, OC-Size.

Keeping the subsequent PROPFIND is so easy... but some people might complain about performance.

@evert

evert commented Dec 21, 2015

Copy link
Copy Markdown

Well, there's another idea.. you could add a specific header to PUT requests indicating that you want the server to return information about the resource... But yea headers would work as well.

@PVince81

Copy link
Copy Markdown
Contributor Author
  • BUG: IE8 requests basic auth when uploading to public page

@PVince81 PVince81 force-pushed the files-ui-webdav-upload branch 2 times, most recently from c78916c to b672770 Compare December 22, 2015 16:41
@PVince81

Copy link
Copy Markdown
Contributor Author

IE8 will not be supported for 9.0, see #15567 (comment)

  • investigate whether iframe transport is needed for IE9+ and others like Safari => yes 😢

@evert

evert commented Dec 23, 2015

Copy link
Copy Markdown

🎉

@PVince81

Copy link
Copy Markdown
Contributor Author

Noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

IE9 also requires the iframe transport.

@PVince81

Copy link
Copy Markdown
Contributor Author

Rebased. Some JS tests will fail, need to look into it.

@PVince81

PVince81 commented Aug 31, 2016

Copy link
Copy Markdown
Contributor Author

The plan is as follows:

  • keep the chunking commit as it refactors stuff a bit further and makes it better, but chunking is disabled (one line can enable it)
  • fix those JS tests
  • retest all upload scenarios listed in the original post
  • motivate people to review this PR

Vincent Petry added 6 commits September 3, 2016 18:24
- uses PUT method with jquery.fileupload for regular and public file
  lists
- for IE and browsers that don't support it, use POST with iframe
  transport
- implemented Sabre plugin to handle iframe transport and redirect the
  embedded PUT request to the proper handler
- added RFC5995 POST to file collection with "add-member" property to
  make it possible to auto-rename conflicting file names
- remove obsolete ajax/upload.php and obsolete ajax routes
Not needed any more in IE >= 11
Hacked around Blueimp's jquery.fileupload to make it work with our new
chunking API.
@PVince81 PVince81 changed the title [WIP] Use Webdav PUT for uploads Use Webdav PUT for uploads Sep 3, 2016
@PVince81

PVince81 commented Sep 3, 2016

Copy link
Copy Markdown
Contributor Author
  • Tested in Firefox, Chromium and IE11.

Ready for review @DeepDiver1975 @butonic @owncloud/qa

@PVince81 PVince81 force-pushed the files-ui-webdav-upload branch from 1d9bfac to a89f4f0 Compare September 3, 2016 16:34
@butonic

butonic commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

Really nice! 👍

That being said I cannot even login in IE8:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)
Timestamp: Mon, 5 Sep 2016 08:42:47 UTC


Message: Object doesn't support this property or method
Line: 2
Char: 29759
Code: 0
URI: https://192.168.56.56/Repositories/oc/core/core/vendor/jquery/dist/jquery.min.js?v=14269cbd8477654a15c200a1df0a28b2


Message: 'jQuery' is undefined
Line: 2
Char: 1
Code: 0
URI: https://192.168.56.56/Repositories/oc/core/core/vendor/jquery-migrate/jquery-migrate.min.js?v=14269cbd8477654a15c200a1df0a28b2

I reverted to 8308348 to see if it was caused by the move to make, but I get the same errors there. I tried IE11 in IE8 emulation and the Win7 IE8 VM: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

@DeepDiver1975 @PVince81 @felixboehm de we still support IE8?

@DeepDiver1975

Copy link
Copy Markdown
Member

Ie8 support is long gone

@DeepDiver1975

Copy link
Copy Markdown
Member

That said - we should prevent users from logging in with unsupported browsers

@butonic

butonic commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

Ok, IE9, uploading a 300mb video fails:

SCRIPT5007: Unable to get value of the property '0': object is null or undefined 
file-upload.js?v=14269cbd8477654a15c200a1df0a28b2, line 287 character 4

@davitol

davitol commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

@butonic In oC 9.1 IE9 is no longer supported. Here are the supported web browsers for oC 9.1.

Web browser: IE11+ (except Compatibility Mode), Firefox 14+, Chrome 18+, Safari 5+

https://doc.owncloud.org/server/9.1/admin_manual/installation/system_requirements.html

@butonic

butonic commented Sep 5, 2016

Copy link
Copy Markdown
Contributor

I scanned the thread from the start and stumbled over IE8 and IE9 ... reading thoroughly would have helped: #21237 (comment)

sorry for the noise

so a 👍 from me

@PVince81

PVince81 commented Sep 6, 2016

Copy link
Copy Markdown
Contributor Author

@butonic yeah, because when I started we still wanted to support IE8 and I had a workaround with an iframe transport plugin... then killed it again when we killed IE9.

Thanks for the reviews.

@lock

lock Bot commented Aug 4, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File upload in browser - use PUT if possible

9 participants