nextcloud-deck
nextcloud-deck copied to clipboard
Display readable error message when attachment exceeds server filesize limit
Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!
Describe the bug
Attached images with more then 2MB throw an error or are not saved in the card without displaying an error
To reproduce Issue is reproducible with an account from try.nextcloud.com:
- [ ] Yes
- [ ] No
Steps to reproduce the behavior:
- Attach an big image
- Click on save
- Image is not saved or an error is displayed
- See error
Expected behavior
Big images may be checked for filesize and then show a dialog with option to cancel the attachment or compress the image
Screenshots
Versions
- Nextcloud: 20
- Nextcloud Deck: 1.2.4
- Nextcloud Android: 3.15.0
- Nextcloud Android Deck: 1.14.4
Smartphone (please complete the following information):
- Device:
- Android-Version:
- App-Store:
- [ ] Google Play Store
- [ ] Google Play Store (Beta channel)
- [x] F-Droid
- [ ] Huawei AppGallery
Are you using LDAP?
- [ ] Yes
- [x] No
Stacktrace
App Version: 1.14.4
App Version Code: 1014004
Server App Version: 1.2.4
App Flavor: fdroid
Files App Version Code: 30150090
---
OS Version: 4.14.116(10.0.0.177C432)
OS API Level: 29
Device: HWBKL
Manufacturer: HUAWEI
Model (and Product): BKL-L09 (BKL-L09)
---
it.niedermann.nextcloud.deck.exceptions.UploadAttachmentFailedException: Unknown URI scheme
at it.niedermann.nextcloud.deck.ui.card.attachments.CardAttachmentsFragment.lambda$null$10$CardAttachmentsFragment(CardAttachmentsFragment.java:452)
at it.niedermann.nextcloud.deck.ui.card.attachments.-$$Lambda$CardAttachmentsFragment$gkS-qyxyaha1P4APW8YauOn8DT0.onChanged(Unknown Source:8)
at it.niedermann.nextcloud.deck.persistence.sync.adapters.db.util.LiveDataHelper$2.onChanged(LiveDataHelper.java:79)
at androidx.lifecycle.LiveData.considerNotify(LiveData.java:131)
at androidx.lifecycle.LiveData.dispatchingValue(LiveData.java:149)
at androidx.lifecycle.LiveData.setValue(LiveData.java:307)
at androidx.lifecycle.MutableLiveData.setValue(MutableLiveData.java:50)
at androidx.lifecycle.LiveData$1.run(LiveData.java:91)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Caused by: com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException: HTTP-Anfrage ist fehlgeschlagen mit HTTP-Statuscode: 500
at com.nextcloud.android.sso.api.AidlNetworkRequest.performNetworkRequestV2(AidlNetworkRequest.java:172)
at com.nextcloud.android.sso.api.NextcloudAPI.performNetworkRequestV2(NextcloudAPI.java:171)
at com.nextcloud.android.sso.api.NextcloudAPI.lambda$performRequestObservableV2$1$NextcloudAPI(NextcloudAPI.java:110)
at com.nextcloud.android.sso.api.-$$Lambda$NextcloudAPI$8WS9mapJbOYsPgbhBi25vBNYZqI.subscribe(Unknown Source:6)
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.ObservableMap.subscribeActual(ObservableMap.java:32)
at io.reactivex.Observable.subscribe(Observable.java:12284)
at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:929)
Caused by: java.lang.IllegalStateException: {"status":500,"message":"No file uploaded or file size exceeds maximum of 2 MB"}
at com.nextcloud.android.sso.InputStreamBinder.processRequestV2(InputStreamBinder.java:429)
at com.nextcloud.android.sso.InputStreamBinder.performNextcloudRequestAndBodyStreamV2(InputStreamBinder.java:125)
at com.nextcloud.android.sso.aidl.IInputStreamService$Stub.onTransact(IInputStreamService.java:137)
at android.os.Binder.execTransactInternal(Binder.java:1028)
at android.os.Binder.execTransact(Binder.java:1001)
Good catch. The problem is, that the 2 MB
limit is set by the server (and is different in each environment), and we can not know this limit before we got the error message.
I agree though, that we should display a more readable error message at the dialog. To achieve this, the exception can be analyzed in the TipsAdapter
similar to other hints we give to the users when we pretty clearly know what went wrong.