android-library
android-library copied to clipboard
Fix issues with HTTP redirects and file upload
Firstly the test setup:
- Nextcloud running behind a reverse proxy (e.g. Traefik) configured for HTTP only
- Configure Nextcloud app to connect to that server
- Configure https on reverse proxy, enable http -> https redirects on the reverse proxy
- Traefik uses the HTTP 308 status code to redirect clients
- Try to upload some pictures via the Auto upload feature
Previously this resulted in the following notification being sent to the user:
With these patches I can successfully upload pictures to my server.
See commit messages for more details.
Lint
Type | master | PR |
Warnings | 1 | 1 |
Errors | 0 | 0 |
SpotBugs (new)
Warning Type | Number |
---|---|
Bad practice Warnings | 14 |
Correctness Warnings | 38 |
Internationalization Warnings | 6 |
Malicious code vulnerability Warnings | 7 |
Multithreaded correctness Warnings | 3 |
Performance Warnings | 17 |
Security Warnings | 1 |
Dodgy code Warnings | 40 |
Total | 126 |
SpotBugs (master)
Warning Type | Number |
---|---|
Bad practice Warnings | 14 |
Correctness Warnings | 38 |
Internationalization Warnings | 6 |
Malicious code vulnerability Warnings | 7 |
Multithreaded correctness Warnings | 3 |
Performance Warnings | 17 |
Security Warnings | 1 |
Dodgy code Warnings | 40 |
Total | 126 |
Codecov Report
Merging #514 into master will increase coverage by
0.06%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## master #514 +/- ##
==========================================
+ Coverage 39.76% 39.82% +0.06%
==========================================
Files 137 137
Lines 5970 5978 +8
Branches 784 789 +5
==========================================
+ Hits 2374 2381 +7
- Misses 3235 3238 +3
+ Partials 361 359 -2
Impacted Files | Coverage Δ | |
---|---|---|
.../main/java/com/nextcloud/common/NextcloudClient.kt | 50.76% <0.00%> (-2.46%) |
:arrow_down: |
...om/owncloud/android/lib/common/OwnCloudClient.java | 38.95% <0.00%> (-0.93%) |
:arrow_down: |
...ources/files/ChunkedFileUploadRemoteOperation.java | 22.76% <0.00%> (-0.19%) |
:arrow_down: |
...d/lib/common/operations/RemoteOperationResult.java | 43.29% <0.00%> (+1.21%) |
:arrow_up: |
...lib/resources/files/RemoveFileRemoteOperation.java | 84.21% <0.00%> (+15.78%) |
:arrow_up: |
Sorry for coming back this late… Permanent redirects should already be handled via login, so that the real redirected url is stored. This way we do not have to do multiple hops per each request.
Have you changed your system after installing the app?
Yes, as mentioned in the original message, the permanent redirect was added after the initial login leading to the issues I was seeing.
Hm. But this then means, that every request is done to times: first against old, get redirect, then to new url. As the library does not store the base url, this should be handled on app side, to update it, once it sees a permanet redirect.
Do you have an idea how to inform the client?
Right.. But as non-HTTP 308 redirect statuses already redirect properly I don't think solving this is in the scope of this - and this PR is just adjusting existing redirect code (for the most part).
Also I'm too unfamiliar with the Nextcloud App codebase with regard to updating the base url.
I will have a deeper look into this soon. Currently I am a bit too busy, but I will not forget your PR.
but I will not forget your PR.
Safe to say this was forgotten.
I'll leave this open but my setup has changed in the meantime so I'm not directly interested in this anymore.