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:
Expected behavior
File is attached successfully
Screenshots
Versions
Smartphone (please complete the following information):
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
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: