Nextcloud-deck: Can't upload file

Created on 23 Jun 2020  ยท  10Comments  ยท  Source: stefan-niedermann/nextcloud-deck

How to use GitHub

  • Please use the ๐Ÿ‘ reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Describe the bug

Related to #547 , I get a failure when trying to attach files to a card, at least a pdf file. I just get the reported error and then the attachment is shown in the card with 0 size, and then I always get the sync error described in #547.

To Reproduce
Steps to reproduce the behavior:

  1. Go to a card
  2. Click on the Attachments tab
  3. Click on the upload file action button
  4. Select a file, I tried with a pdf file
  5. See error

Expected behavior

File is attached successfully

Screenshots

Versions

  • Nextcloud: 18.0.6
  • Nextcloud Deck: 1.0.2
  • Nextcloud Android: 3.12.0
  • Nextcloud Android Deck: 1.5.0

Smartphone (please complete the following information):

  • Device: lg g6
  • Android-Version: 9
  • App-Store:

    • [ ] Google Play Store

    • [x] F-Droid

Stacktrace

App Version: 1.5.0
App Version Code: 1005000
App Flavor: fdroid

Files App Version Code: 30120090

---

OS Version: 3.18.120-perf+(1930916292597)
OS API Level: 28
Device: lucye
Manufacturer: LGE
Model (and Product): LG-H870 (lucye_global_com)

---

java.lang.IllegalStateException: failed to build request-body
    at com.nextcloud.android.sso.api.NextcloudRetrofitServiceMethod.bodyToStream(NextcloudRetrofitServiceMethod.java:218)
    at com.nextcloud.android.sso.api.NextcloudRetrofitServiceMethod.invoke(NextcloudRetrofitServiceMethod.java:164)
    at retrofit2.NextcloudRetrofitApiBuilder.lambda$create$0$NextcloudRetrofitApiBuilder(NextcloudRetrofitApiBuilder.java:30)
    at retrofit2.-$$Lambda$NextcloudRetrofitApiBuilder$U6rJlQEKMLSg7zB4KqSP_SBh3BM.invoke(Unknown Source:2)
    at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
    at $Proxy2.uploadAttachment(Unknown Source)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.ServerAdapter.lambda$uploadAttachment$26$ServerAdapter(ServerAdapter.java:282)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.-$$Lambda$ServerAdapter$uu8p1FGbrAMZqv7noZNb699-7WM.getObservableFromCall(Unknown Source:12)
    at it.niedermann.nextcloud.deck.api.RequestHelper.request(RequestHelper.java:33)
    at it.niedermann.nextcloud.deck.persistence.sync.adapters.ServerAdapter.uploadAttachment(ServerAdapter.java:282)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.AttachmentDataProvider.createOnServer(AttachmentDataProvider.java:68)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.providers.AttachmentDataProvider.createOnServer(AttachmentDataProvider.java:18)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.DataPropagationHelper.createEntity(DataPropagationHelper.java:37)
    at it.niedermann.nextcloud.deck.persistence.sync.helpers.DataPropagationHelper.createEntity(DataPropagationHelper.java:22)
    at it.niedermann.nextcloud.deck.persistence.sync.SyncManager.lambda$addAttachmentToCard$39$SyncManager(SyncManager.java:1292)
    at it.niedermann.nextcloud.deck.persistence.sync.-$$Lambda$SyncManager$01e_nNGgSsez-E9cPxTAKgBmK4o.run(Unknown Source:12)
    at java.lang.Thread.run(Thread.java:764)
Caused by: java.io.FileNotFoundException: /sdcard/Android/media/com.nextcloud.client/nextcloud/luca@(Domain)/Documents/Papeletas/Envivas/2020-02-12-factura-pediatra-2a0cdd6bec3b0460db7c9c25a49b3f1d27e7b5a2.pdf (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:231)
    at java.io.FileInputStream.<init>(FileInputStream.java:165)
    at okio.Okio.source(Okio.java:168)
    at okhttp3.RequestBody$3.writeTo(RequestBody.java:170)
    at okhttp3.MultipartBody.writeOrCountBytes(MultipartBody.java:173)
    at okhttp3.MultipartBody.writeTo(MultipartBody.java:114)
    at com.nextcloud.android.sso.api.NextcloudRetrofitServiceMethod.bodyToStream(NextcloudRetrofitServiceMethod.java:214)
    ... 16 more

โ” needs info ๐Ÿž bug

All 10 comments

Did you share from Nextcloud to Deck or did you open the Deck app, open a card and then select an attachment via the upload button?

I clicked on the upload button in the deck app

On 23 June 2020 09:36:07 GMT+02:00, Niedermann IT-Dienstleistungen notifications@github.com wrote:

Did you share from Nextcloud to Deck or did you open the Deck app,
open a card and then select an attachment via the upload button?

--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
https://github.com/stefan-niedermann/nextcloud-deck/issues/550#issuecomment-647966483

--
Leandro Lucarella (luca)
Sent from my phone. Please excuse my brevity and any typos.

And this happens everytime you try to attach a file to a card? Or does always the same error appear (of the same file)?

Can you upload othet attachments without problems?

It is super weird. Now it is working, I tried with different file types (jpg, mp4 and pdf) at first in a new card and in a new deck and it worked, but then in the same card that gave me the error I posted here, with the same file, and now it worked.

Okay, i am pretty sure that the root cause is the same as in #547.

Let's wait for 1.5.3 as i said and open a new issue if the bug still occurs with this version ๐Ÿ˜‰

OK, now I could reproduce it, I wasn't using the exact same file. The problem seems to happen when trying to attach files that live in an external SD card.

Any file I try to attach that lives in the external SD cards causes a crash.

Are you still sure that this is the same root cause as #547 or maybe this shall be kept opened for now?

Indeed, i will have further look.

Tested and can confirm that i get the exact same message

java.lang.IllegalStateException: failed to build request-body

with version 1.5.0, but it works flawlessly with 1.5.3.

Don't know whether or not the root cause is the same, but it is fixed in 1.5.3 :smile:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cappuMUC picture cappuMUC  ยท  3Comments

R4U5CH1337 picture R4U5CH1337  ยท  3Comments

lachmanfrantisek picture lachmanfrantisek  ยท  7Comments

jancborchardt picture jancborchardt  ยท  7Comments

stefan-niedermann picture stefan-niedermann  ยท  7Comments