nextcloud / nextcloud/ios

Add support for temporary redirects 302

Open
#732 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
2.5k
Forks
1k
Avg merge
2d 18h
Merged PRs (30d)
13

Description

Expected behaviour

Temporary redirects 302 are supported and not treated as permanent redirects.

Actual behaviour

Temporary redirects 302 are not supported. The app treats 302 as a permanent redirect and uses the last url (after redirects) as authoritative. However, as the redirect is temporary the last url may not be available in the future.

NCManageDatabase::getDirectoryId is always called with the URL after redirects without considering whether they are temporary or permanent.

Steps to reproduce
  1. Run nextcloud on port 8081
  2. Setup server to listen on port 8082 and send a redirect code 301 to same url but on port 8081.
  3. Try to login in through desktop app with port 8082.
  4. All fine, files are able to download, upload, etc.
  5. Kill app
  6. Remove redirection from server
  7. Move nextcloud to listen on port 8082
  8. Run app again
  9. It fails to download any file
iOS version

iOS 12.1

App version

Testflight version 2.22.6 (17)

Server configuration

Operating system:

Debian Linux

Web server:

Apache

Database:

default

PHP version:

default from snap

Nextcloud version: (see Nextcloud admin page)

13.0.7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at NCManageDatabase::getDirectoryId and trace how the iOS app handles URLs after HTTP redirects. Reproduce the port-redirect sequence described in the issue, then verify that a temporary 302 is not treated as permanent and that the app still works after the redirect is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.