nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.95k stars 878 forks source link

open folder containing `#` results in 405 error #1196

Open dennis-eisen opened 4 years ago

dennis-eisen commented 4 years ago

Expected behaviour

open folder containing # sign

Actual behaviour

405 error message

hash is not encoded right. Works perfectly in Android App.

Server error message

{"reqId":"k17J7PpoAREU7opftXGj","level":0,"time":"2020-03-23T20:52:32+00:00","remoteAddr":"87.165.126.121","user":"denniseisen","app":"webdav","method":"PROPFIND","url":"/remote.php/webdav/Royal%20Rangers/Royal%20Rangers%2059/2","message":{"Exception":"Sabre\\DAV\\Exception\\NotFound","Message":"File with name Royal Rangers/Royal Rangers 59/2 could not be located","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":967,"function":"getNodeForPath","class":"OCA\\DAV\\Connector\\Sabre\\ObjectTree","type":"->","args":["Royal Rangers/Royal Rangers 59/2"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["Royal Rangers/Royal Rangers 59/2",["{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{DAV:}quota-available-bytes","{DAV:}quota-used-bytes","{DAV:}creationdate","{http://owncloud.org/ns}permissions","{http://owncloud.org/ns}id","{http://owncloud.org/ns}fileid","{http://owncloud.org/ns}size","{http://owncloud.org/ns}favorite","{http://owncloud.org/ns}share-types","{http://owncloud.org/ns}owner-id","{http://owncloud.org/ns}owner-display-name","{http://owncloud.org/ns}comments-unread","{http://nextcloud.org/ns}is-encrypted","{http://nextcloud.org/ns}has-preview","{http://nextcloud.org/ns}mount-type","{http://nextcloud.org/ns}rich-workspace"],0]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://lunaline.de/remote.php/webdav/Royal%20Rangers/Royal%20Rangers%2059/2","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https://lunaline.de/remote.php/webdav/Royal%20Rangers/Royal%20Rangers%2059/2","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https://lunaline.de/remote.php/webdav/Royal%20Rangers/Royal%20Rangers%2059/2","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://lunaline.de/remote.php/webdav/Royal%20Rangers/Royal%20Rangers%2059/2","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/apps/dav/appinfo/v1/webdav.php","line":82,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":165,"args":["/var/www/html/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/var/www/html/apps/dav/lib/Connector/Sabre/ObjectTree.php","Line":173,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (iOS) Nextcloud-iOS/2.25.9","version":"18.0.1.3"}

Steps to reproduce

open folder containing # in iOS Nextcloud App

Reasoning or why should it be changed/implemented?

its a bug

iOS version

13.3.1

App version

2.25.9.2

milux commented 4 years ago

Briefly explained, as you can also see in the server logs above, the iOS app fails to encode # to %23, as it should, and the server therefore truncates the URL at the #. This might also happen for other special characters, please check. Doesn't happen for Android App, Web UI or Sync Clients on Windows and MacOSX.

milux commented 4 years ago

This is a problematic bug and not a feature request. Would you mind to add the "bug" label?

rygen commented 4 years ago

Not sure if this is related to the same issue, but lately I've been seeing 405's being thrown all the time when using the iOS app. I even tried a fresh install of the app but I'm still greeted by the pesky 405s.

At a first glance it appears to me that the issue here might be solved with processing the string with .addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed). I don't know exactly where to look since it's a big project and I haven't touched it in a few years 🙈, but I'm happy to try it out and submit a PR - I must first find where the "offending" text is though... any hints appreciated :)

Regarding my pool of 405s,

Steps to reproduce:

Build the app from the develop branch Login with an empty test user Go to files

Expected results:

No error

Actual results:

Error with message "Request failed: method not allowed (405)"

Simulator Screen Shot - iPhone 11 Pro - 2020-04-06 at 22 22 14

Further info

To reproduce it several times, you can for instance switch from the tab More to Media.

I can move this to a new ticket if not related to #1196.

marinofaggiana commented 4 years ago

@rygen du you have try with the version 3 in TestFlight?

rygen commented 4 years ago

@marinofaggiana regarding my device - I was still on the App Store version. I've now tried the TestFlight version as you suggested and the 405s seem to be gone. 🎉 However, the reproduction steps above were done after building from the latest commit on develop.