notes-android icon indicating copy to clipboard operation
notes-android copied to clipboard

Notes throws error upon first configuration if ShareAPI is disabled

Open goddib opened this issue 3 months ago • 4 comments

This issue respects the following points:

Describe the bug

I have recently bought a new phone and I am setting up like my old one. I had Nextcloud and Notes working on my old phone. However, when setting up Notes on my new phone, I get an error.

  1. Install Nextcloud App
  2. Set up Account on Nextcloud App
  3. Install Notes App
  4. Open App
  5. Klick "Select Account"
  6. Select Account
  7. Klick "OK"
  8. Allow account access
  9. Error message

Expected behavior

Notes from Nextcloud instances get loaded. This has worked with the same Notes/Nextcloud/App version combination on my old phone previously.

Notes Android version

4.4.2

Notes server version

4.12.3

Nextcloud Android version

3.32.3

Nextcloud version

31.0.8

Device

Google Pixel 10 Pro

Android Version

16

App Store

  • [ ] Google Play Store
  • [x] F-Droid
  • [ ] Huawei App Gallery

Stacktrace

App Version: 4.4.2
App Version Code: 40040290
App Flavor: fdroid

Files App Version Code: 30320390 (PROD)

---

OS Version: 6.6.82-android15-8-gd4aed7ed470e-ab13759939-4k(13955164)
OS API Level: 36
Device: blazer
Manufacturer: Google
Model (and Product): Pixel 10 Pro (blazer)

---

java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.gson.JsonPrimitive com.google.gson.JsonObject.getAsJsonPrimitive(java.lang.String)' on a null object reference
	at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:75)
	at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:32)
	at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:95)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:271)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:561)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:519)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$2.readIntoField(ReflectiveTypeAdapterFactory.java:271)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$FieldReflectionAdapter.readField(ReflectiveTypeAdapterFactory.java:561)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:519)
	at com.google.gson.Gson.fromJson(Gson.java:1359)
	at com.google.gson.Gson.fromJson(Gson.java:1260)
	at com.google.gson.Gson.fromJson(Gson.java:1228)
	at com.nextcloud.android.sso.api.NextcloudAPI.convertStreamToTargetEntity(NextcloudAPI.java:136)
	at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$0(NextcloudAPI.java:98)
	at com.nextcloud.android.sso.api.NextcloudAPI.$r8$lambda$af7W9mq2B0ZrhVJwZd-ibFp8T3Y(Unknown Source:0)
	at com.nextcloud.android.sso.api.NextcloudAPI$$ExternalSyntheticLambda1.subscribe(D8$$SyntheticClass:0)
	at io.reactivex.internal.operators.observable.ObservableFromPublisher.subscribeActual(ObservableFromPublisher.java:31)
	at io.reactivex.Observable.subscribe(Observable.java:12284)
	at io.reactivex.internal.operators.observable.ObservableSingleMaybe.subscribeActual(ObservableSingleMaybe.java:31)
	at io.reactivex.Maybe.subscribe(Maybe.java:4290)
	at io.reactivex.Maybe.blockingGet(Maybe.java:2320)
	at io.reactivex.Observable.blockingSingle(Observable.java:5381)
	at it.niedermann.owncloud.notes.persistence.CapabilitiesClient.getCapabilities(CapabilitiesClient.java:38)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity.lambda$onActivityResult$5(ImportAccountActivity.java:103)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity.$r8$lambda$wIJzzcgrzM9d6k7exwdLMn3GvgQ(Unknown Source:0)
	at it.niedermann.owncloud.notes.importaccount.ImportAccountActivity$$ExternalSyntheticLambda4.run(D8$$SyntheticClass:0)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:524)
	at java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651)
	at 

java.lang.Thread.run(Thread.java:1119)

goddib avatar Sep 05 '25 14:09 goddib

at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:75)

I wouldn't expect this unless the response from the server is malformed or, perhaps, the ShareAPI on the server is disabled.

Is public share link password enforcement on or off on the server?

joshtrichards avatar Sep 08 '25 00:09 joshtrichards

at it.niedermann.owncloud.notes.persistence.sync.CapabilitiesDeserializer.deserialize(CapabilitiesDeserializer.java:75)

I wouldn't expect this unless the response from the server is malformed or, perhaps, the ShareAPI on the server is disabled.

Is public share link password enforcement on or off on the server?

Hi @joshtrichards, I can confirm that the public share API was disabled and enabling is fixed the issue.

It seems that some time over the last few months in an attempt to harden my installation I had disabled it. However, the notes android app on my previous phone had kept working, only enabling a new notes android app did not work without the API.

Thank you for your help!

goddib avatar Sep 08 '25 07:09 goddib

Glad it was something simple-ish on your end. I'll keep this open here since that should still be handled better. Thanks for the report!

joshtrichards avatar Sep 09 '25 19:09 joshtrichards

This is a duplicate of #2733, which was fixed by #2803, but has not made it into a new release yet.

leper avatar Sep 10 '25 17:09 leper