stefan-niedermann / nextcloud-deck

📋 Android client for nextcloud deck app
https://play.google.com/store/apps/details?id=it.niedermann.nextcloud.deck.play
GNU General Public License v3.0
500 stars 53 forks source link

Cannot upload image #1689

Open bege10 opened 3 weeks ago

bege10 commented 3 weeks ago

This issue respects the following points:

Describe the bug

  1. Edit card
  2. Tap on attachment button
  3. Tap on upload button
  4. select image from galery
  5. Tap on add button
  6. See error notification

``

Expected behavior

Upload image

Deck Android version

1.24.1

Deck server version

1.12.4

Nextcloud Android version

3.30.1

Nextcloud version

cannot find version no. It is managed nextcloud at nextcloud.hosting.zone

Device

Shiftphone 6mq

Android Version

/e/OS Android 13

App Store

Stacktrace

App Version: 1.24.1
App Version Code: 1024001
Server App Version: 1.12.4
App Flavor: fdroid

Files App Version Code: 30300190 (PROD)

---

OS Version: 4.9.337-lineage+(eng.root.20241009.165926)
OS API Level: 33
Device: axolotl
Manufacturer: SHIFT
Model (and Product): SHIFT6mq (lineage_axolotl)

---

it.niedermann.nextcloud.deck.exceptions.UploadAttachmentFailedException: Unknown URI scheme
    at it.niedermann.nextcloud.deck.ui.card.attachments.CardAttachmentsFragment$5.onError(CardAttachmentsFragment.java:387)
    at it.niedermann.nextcloud.deck.remote.api.ResponseCallback$1.onError(ResponseCallback.java:76)
    at it.niedermann.nextcloud.deck.remote.helpers.DataPropagationHelper$1.lambda$onError$1(DataPropagationHelper.java:70)
    at it.niedermann.nextcloud.deck.remote.helpers.DataPropagationHelper$1$$ExternalSyntheticLambda1.run(Unknown Source:4)
    at it.niedermann.nextcloud.deck.util.ExecutorServiceProvider$RetryableRunnable.run(ExecutorServiceProvider.java:66)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP-Anfrage ist fehlgeschlagen mit HTTP-Statuscode: 400
    at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onResponse(RequestHelper.java:70)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$enqueue$0(Retrofit2Helper.java:87)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1.$r8$lambda$n0izO5V3AflskH7z1H8dSLmVKXo(Unknown Source:0)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
    ... 1 more
Caused by: java.lang.RuntimeException: HTTP StatusCode wasn't 2xx:
Got [HTTP 400] for Call [GET http://localhost//index.php/apps/deck/api/v1.0/boards/1/stacks/1/cards/4/attachments] with Message:
[{"status":400,"message":"type must be provided and must be not empty"}
]
    at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.buildCause(RequestHelper.java:87)
    ... 5 more
NiksaVel commented 5 days ago

I seem, to have the identical error on my new phone.

`

App Version: 1.24.1
App Version Code: 1024001
Server App Version: 1.14.1
App Flavor: fdroid

Files App Version Code: 30300390 (PROD)

---

OS Version: 6.1.68-android14-11-ge1e7d630d60a-ab11934653(8.0.0.206C431E4R2P2)
OS API Level: 34
Device: HNBVL
Manufacturer: HONOR
Model (and Product): BVL-N49 (BVL-N49EEA)

---

it.niedermann.nextcloud.deck.exceptions.UploadAttachmentFailedException: Unknown URI scheme
    at it.niedermann.nextcloud.deck.ui.card.attachments.CardAttachmentsFragment$5.onError(CardAttachmentsFragment.java:387)
    at it.niedermann.nextcloud.deck.remote.api.ResponseCallback$1.onError(ResponseCallback.java:76)
    at it.niedermann.nextcloud.deck.remote.helpers.DataPropagationHelper$1.lambda$onError$1(DataPropagationHelper.java:70)
    at it.niedermann.nextcloud.deck.remote.helpers.DataPropagationHelper$1$$ExternalSyntheticLambda1.run(Unknown Source:4)
    at it.niedermann.nextcloud.deck.util.ExecutorServiceProvider$RetryableRunnable.run(ExecutorServiceProvider.java:66)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
    at java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
    at java.lang.Thread.run(Thread.java:1012)
Caused by: com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP request failed with HTTP status-code: 400
    at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.onResponse(RequestHelper.java:70)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1.lambda$enqueue$0(Retrofit2Helper.java:87)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1.$r8$lambda$n0izO5V3AflskH7z1H8dSLmVKXo(Unknown Source:0)
    at com.nextcloud.android.sso.helper.Retrofit2Helper$1$$ExternalSyntheticLambda0.run(Unknown Source:6)
    ... 1 more
Caused by: java.lang.RuntimeException: HTTP StatusCode wasn't 2xx:
Got [HTTP 400] for Call [GET http://localhost//index.php/apps/deck/api/v1.0/boards/5/stacks/18/cards/218/attachments] with Message:
]
[{"status":400,"message":"type must be provided and must be not empty"}
    at it.niedermann.nextcloud.deck.remote.api.RequestHelper$ResponseConsumer.buildCause(RequestHelper.java:87)
    ... 5 more

I have the same setup on my old Fairphone 5 and everything (still) works okay. I've installed either the Gstore or F-droid versions of the deck app and neither will attach manually a file to a card or share to a card from another app. `

desperateCoder commented 5 days ago

Hi! thank you for your reports!

To me, this doesn't seem to be on our side. We haven't even a parameter to provide a type, thus i'd suspect a weird data constellation on the servers side.

@AndyScherzinger @juliusknorr Do you have any idea, what could go wrong here? I had a quick look at the controller and services regarding Attachments in your code, but couldn't find the String in question:

{"status":400,"message":"type must be provided and must be not empty"}

The call is the following:

GET apps/deck/api/v1.0/boards/5/stacks/18/cards/218/attachments

NiksaVel commented 5 days ago

Please let me clarify again - this started happening on my new phone (Honor Magic 6 pro), while on my old phone (Fairphone 5) which is still fully functional (except for the lame battery) everything is working fine with the same server, same app. Pretty sure it's something with the phone OS, but I am not a programmer... all I know is that permissions are the same, not sure what else I can do as a user to make it work.

ultr41337h4xor commented 4 days ago

Same error here, when uploading attachments through the F-Droid Android app on a Fairphone 3.

juliusknorr commented 2 days ago

The check is performed here:

https://github.com/nextcloud/deck/blob/439c2b422e6e3055c04ca24192999116980aa155/lib/Service/AttachmentService.php#L180 https://github.com/nextcloud/deck/blob/main/lib/Validators/AttachmentServiceValidator.php#L14

The type parameter is documented in the API docs https://deck.readthedocs.io/en/latest/API/#post-boardsboardidstacksstackidcardscardidattachments-upload-an-attachment (should be set to file in all cases, we could probably just default to that on the server side). The error definitely indicates that the parameter is not sent along and seing it work on some devices would point to some issue on the client side then.

NiksaVel commented 21 hours ago

Switched from fdroid to gplay store version of the main nextcloud app and everything seems to be working now. While searching the comments and forums, someone mentioned that only the gstore talk app gives notifications... when I switched all apps to the gstore version, everything started working, both notifications and file uploads.

desperateCoder commented 18 hours ago

Thanks @juliusknorr for clarifying!

Thats weird, we always send a type: https://github.com/stefan-niedermann/nextcloud-deck/blob/master/app/src/main/java/it/niedermann/nextcloud/deck/remote/adapters/ServerAdapter.java#L240

@NiksaVel

Switched from fdroid to gplay store version of the main nextcloud app and everything seems to be working now

From the code's point of view, at least inside our app, this shouldn't make any difference. Its the same code for all releases. The only thing that might differ is the Nextcloud Files app (the main Nextcloud app), which does the actual network requests for us. And now this all starts to make sense!

@NiksaVel can you please post the versions of the F-Droid and Play Store apps, so we can compare? @ultr41337h4xor which version do you use? If F-Droid: does using the Play version fix it for you as well?

NiksaVel commented 17 hours ago

Nextcloud app in play store is 3.29.2 Fdroid version is 3.30.4

Deck app in play store is 1.24.1 Fdroid is 1.24.1

desperateCoder commented 17 hours ago

@NiksaVel thanks for the quick response! I asked our Nextcloud buddies, if there were breaking changes. Let's see what they say, I'll reach out to you as soon as I got news.

@ultr41337h4xor it would be still interesting, what version was breaking it for you ❤️

AndyScherzinger commented 18 minutes ago

Looping in @tobiasKaminsky @alperozturk96 @zetaTom then