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

Access not possible when using a HTTP redirect #200

Open
christianlupus opened this issue Apr 26, 2020 · 2 comments
Open

Access not possible when using a HTTP redirect #200

christianlupus opened this issue Apr 26, 2020 · 2 comments

Comments

@christianlupus
Copy link

I have an NC installation that was relocated in the past. To keep things for older installations/users working I added an HTTP redirect (302 at the moment). This breaks the notes app on android.
I contacted the developer there and he tells me that he uses this library in order to do all network-based stuff. He asked me to open an issue here to ake you aware of the issue.

Here is the information I got from the app:
App Version: 2.11.8
App Version Code: 2011008
App Flavor: play

Files App Version Code: 30110151

---

OS Version: 3.0.31-1678704(N8000XXSDQA7)
OS API Level: 19
Device: p4noterf
Manufacturer: samsung
Model (and Product): GT-N8000 (p4noterfxx)

---

com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: 
HTTP-Anfrage ist fehlgeschlagen mit HTTP-Statuscode: 302
        at 
com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:172)
        at 
com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:148)
        at 
it.niedermann.owncloud.notes.persistence.NotesClient.requestServer(NotesClient.java:162)
        at 
it.niedermann.owncloud.notes.persistence.NotesClient.getNotes(NotesClient.java:98)
        at 
it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.pullRemoteChanges(NoteServerSyncHelper.java:446)
        at 
it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:358)
        at 
it.niedermann.owncloud.notes.persistence.NoteServerSyncHelper$SyncTask.doInBackground(NoteServerSyncHelper.java:320)
        at android.os.AsyncTask$2.call(AsyncTask.java:288)
        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
        at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.IllegalStateException: <!DOCTYPE HTML PUBLIC 
"-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a 
href="https://new.url.of.my.installation/nextcloud/index.php/apps/notes/api/v0.2/notes?pruneBefore=0">here</a>.</p>
</body></html>

        at 
com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:438)
        at 
com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:135)
        at 
com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestV2(InputStreamBinder.java:118)
        at 
com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:134)
        at android.os.Binder.execTransact(Binder.java:404)
        at dalvik.system.NativeStart.run(Native Method)

I only changed the URL domain in the backtrace.

If you need more information or anything I can provide, please let me know.

@stefan-niedermann
Copy link
Member

@christianlupus can you please try again with Nextcloud Android 3.17 and Notes Android 3.2.5 or higher?

Please make sure to clear the storage of the Notes app properly as described in our FAQ - a deinstallation and reinstallation is not the same. Please also remove and readd your account in the Nextcloud Android app.

Finally: Please name the exact version of yoir server side Notes app - it should be 4.1.1.

@newhinton
Copy link
Contributor

I have the same issue. I am trying to access the cookbook api, which results in a 302 redirect, and the request fails.
The strange thing is that there should not be a redirect, the api should return the properly sized image on that endpoint. The request is made with performNetworkRequestV2 using Android-SingleSignOn:0.6.0

val url = "/apps/cookbook/recipes/$recipe_id/image?size=thumb"
...
val nextcloudRequest: NextcloudRequest = NextcloudRequest.Builder()
    .setMethod("GET")
    .setUrl(url)
    .build()

I then tried to switch to the Parameter-based query, but this fails with a different error

var size = "thumb"
val url = "/apps/cookbook/recipes/$recipe_id/image"
...
val parameters = Collections.singleton(QueryParam("size", size))
        val nextcloudRequest: NextcloudRequest = NextcloudRequest.Builder()
            .setMethod("GET")
            .setUrl(url)
            .setParameter(parameters)
            .build()

Error, just for completeness sake
com.nextcloud.android.sso.exceptions.UnknownErrorException: com.nextcloud.android.sso.QueryParam; local class incompatible: stream classdesc serialVersionUID = 21523240203234211, local class serialVersionUID = -2413260979044997003

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

No branches or pull requests

4 participants