Share file to Nextcloud results in a Connection error
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
### ⚠️ Before posting ⚠️
- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Steps to reproduce
1. Use the "Share" button on a file in any app, for instance on a picture in the Gallery
2. Click "Nextcloud"
3. Select the root or any folder
4. Try to upload
### Expected behaviour
Uploading a file using the "Share" button should work without the need to go into the app and retry the upload every time
### Actual behaviour
File upload fails immediately with the notification "Upload failed - Could not upload FILE_NAME.EXTENSION". Navigating to the Uploads tab in the app shows "Connection error". Clicking the file in this tab makes Nextcloud try to upload again and it succeeds. This behavior is 100% consistent.
### Android version
14
### Device brand and model
Samsung S21+ 5G
### Stock or custom OS?
Stock
### Nextcloud android app version
3.30.7
### Nextcloud server version
30.0.0
### Using a reverse proxy?
Yes
### Android logs
```
01-15 15:43:27.319 26679 26799 D UploadsStorageManager: QUERY: status==0 AND account_name== ? ROWID: -1
01-15 15:43:27.327 26679 26799 D FileUploadWorker: Total upload size: 1
01-15 15:43:27.327 26679 26799 D FileUploadWorker: Handling 1 uploads for account pg@nextcloud.mydomain.com
--------- beginning of system
01-15 15:43:27.335 26679 26799 I NotificationManager: com.nextcloud.client: notify(411, null, Notification(channel=NOTIFICATION_CHANNEL_DOWNLOAD shortcut=null contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x0 color=0xff96ccff actions=1 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user
01-15 15:43:27.342 26679 26799 D UploadsStorageManager: Retrieve job com.owncloud.android.db.OCUpload@b1c5ac9 for id 30
01-15 15:43:27.342 26679 26799 V UploadsStorageManager: Updating /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg with status=UPLOAD_IN_PROGRESS
01-15 15:43:27.344 26679 26799 D UploadsStorageManager: updateUpload returns with: 1 for file: /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg
01-15 15:43:27.344 26679 26799 D UploadsStorageManager: notifyObserversNow
01-15 15:43:27.347 26679 26799 D UploadFileOperation: normal upload
01-15 15:43:27.351 26679 26799 E UploadFileOperation: Upload of /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg to /Talk/IMG-20250115-WA0015.jpg: No network connection
01-15 15:43:27.352 26679 26799 D UploadsStorageManager: updateDatabaseUploadResult uploadResult: RemoteOperationResult{mSuccess=false, mHttpCode=-1, mHttpPhrase='null', mException=null, mCode=NO_NETWORK_CONNECTION, message='null', getLogMessage='No network connection'} upload: com.owncloud.android.operations.UploadFileOperation@f3215ce
01-15 15:43:27.356 26679 26799 V UploadsStorageManager: Updating /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg with status:UPLOAD_FAILED and result:NETWORK_CONNECTION (old:/storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg status:UPLOAD_IN_PROGRESS result:-1)
01-15 15:43:27.356 26679 26799 V UploadsStorageManager: Updating /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg with status=UPLOAD_FAILED
01-15 15:43:27.358 26679 26799 D UploadsStorageManager: updateUpload returns with: 1 for file: /storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg
01-15 15:43:27.358 26679 26799 D UploadsStorageManager: notifyObserversNow
01-15 15:43:27.358 26679 26799 D FileUploadWorker: NotifyUploadResult with resultCode: NO_NETWORK_CONNECTION
01-15 15:43:27.360 26679 26799 I NotificationManager: com.nextcloud.client: notify(413, /Talk/IMG-20250115-WA0015.jpg/storage/emulated/0/Android/media/com.nextcloud.client/nextcloud/tmp/pg@nextcloud.mydomain.com/Talk/IMG-20250115-WA0015.jpg, Notification(channel=NOTIFICATION_CHANNEL_DOWNLOAD shortcut=null contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x0 color=0xff96ccff vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)) as user
01-15 15:43:27.363 26679 26799 D UploadsStorageManager: QUERY: (status==0 AND account_name== ?) AND _id > ? ROWID: 30
01-15 15:43:27.367 26679 26799 D FileUploadWorker: No more pending uploads for account pg@nextcloud.mydomain.com, stopping work
01-15 15:43:27.382 26679 26738 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=a8221592-2c5c-47f5-9f38-158a790195d4, tags={ com.nextcloud.client.jobs.upload.FileUploadWorker, *, name:files_upload pg@nextcloud.mydomain.com, timestamp:1736952207237, class:FileUploadWorker, user:pg@nextcloud.mydomain.com, files_uploadpg@nextcloud.mydomain.com } ]
01-15 15:43:27.654 26679 26679 I ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: handleAppVisibility mAppVisible = true visible = false
01-15 15:43:27.661 26679 26679 I ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: destroyHardwareResources: Callers=android.view.ViewRootImpl.performTraversals:3932 android.view.ViewRootImpl.doTraversal:3288 android.view.ViewRootImpl$TraversalRunnable.run:11344 android.view.Choreographer$CallbackRecord.run:1689 android.view.Choreographer$CallbackRecord.run:1698 android.view.Choreographer.doCallbacks:1153 android.view.Choreographer.doFrame:1079 android.view.Choreographer$FrameDisplayEventReceiver.run:1646 android.os.Handler.handleCallback:958 android.os.Handler.dispatchMessage:99
01-15 15:43:27.670 26679 26679 I InsetsController: onStateChanged: host=com.nextcloud.client/com.owncloud.android.ui.activity.ReceiveExternalFilesActivity, from=android.view.ViewRootImpl.relayoutWindow:10072, state=InsetsState: {mDisplayFrame=Rect(0, 0 - 1080, 2400), mDisplayCutout=DisplayCutout{insets=Rect(0, 75 - 0, 0) waterfall=Insets{left=0, top=0, right=0, bottom=0} boundingRect={Bounds=[Rect(0, 0 - 0, 0), Rect(512, 0 - 569, 75), Rect(0, 0 - 0, 0), Rect(0, 0 - 0, 0)]} cutoutPathParserInfo={CutoutPathParserInfo{displayWidth=1080 displayHeight=2400 physicalDisplayWidth=1080 physicalDisplayHeight=2400 density={2.8125} cutoutSpec={M 0, 0 H -10.13333333333333 V 26.66666666666667 H 10.13333333333333 V 0 H 0 Z @dp} rotation={0} scale={1.0} physicalPixelDisplaySizeRatio={1.0}}}}, mRoundedCorners=RoundedCorners{[RoundedCorner{position=TopLeft, radius=90, center=Point(90, 90)}, RoundedCorner{position=TopRight, radius=90, center=Point(990, 90)}, RoundedCorner{position=BottomRight, radius=90, center=Point(990, 2310)}, RoundedCorner{position=BottomLeft, radius=90, center=Point(90, 2310)}]} mRoundedCornerFrame=Rect(0, 0 - 1080, 2400), mPrivacyIndicatorBounds=PrivacyIndicatorBounds {static bounds=Rect(964, 0 - 1080, 75) rotation=0}, mDisplayShape=DisplayShape{ spec=-311912193 displayWidth=1080 displayHeight=2400 physicalPixelDisplaySizeRatio=1.0 rotation=0 offsetX=0 offsetY=0 scale=1.0}, mSources= { InsetsSource: {be090000 mType=statusBars mFrame=[0,0][1080,75] mVisible=true mFlags=[]}, InsetsSource: {be090005 mType=mandatorySystemGestures mFrame=[0,0][1080,107] mVisible=true mFlags=[]}, InsetsSource: {be090006 mType=tappableElement mFrame=[0,0][1080,75] mVisible=true mFlags=[]}, InsetsSource: {3 mType=ime mFrame=[0,0][0,0] mVisible=false mFlags=[]}, InsetsSource: {27 mType=displayCutout mFrame=[0,0][1080,75] mVisible=true mFlags=[]}, InsetsSource: {5d0001 mType=navigationBars mFrame=[0,2274][1080,2400] mVisible=true mFlags=[]}, InsetsSource: {5d0004 mType=systemGestures mFrame=[0,0][0,0] mVisible=true mFlags=[]}, InsetsSource: {5d0005 mType=mandatorySystemGestures mFrame=[0,2274][1080,2400] mVisible=true mFlags=[]}, InsetsSource: {5d0006 mType=tappableElement mFrame=[0,2274][1080,2400] mVisible=true mFlags=[]}, InsetsSource: {5d0024 mType=systemGestures mFrame=[0,0][0,0] mVisible=true mFlags=[]} }
01-15 15:43:27.672 26679 26679 I ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: Relayout returned: old=(120,1027,960,1321) new=(120,1027,960,1321) relayoutAsync=false req=(840,294)8 dur=7 res=0x402 s={false 0x0} ch=true seqId=0
01-15 15:43:27.672 26679 26741 D OpenGLRenderer: CacheManager::trimMemory(40)
01-15 15:43:27.672 26679 26679 I ViewRootImpl@7e01ee7[ReceiveExternalFilesActivity]: handleAppVisibility mAppVisible = true visible = false
01-15 15:43:27.673 26679 26679 I ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: stopped(true) old = false
01-15 15:43:27.673 26679 26679 D ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: WindowStopped on com.nextcloud.client/com.owncloud.android.ui.activity.ReceiveExternalFilesActivity set to true
01-15 15:43:27.686 26679 26741 D OpenGLRenderer: RenderThread::destroyRenderingContext()
01-15 15:43:27.695 26679 26679 I ViewRootImpl@7e01ee7[ReceiveExternalFilesActivity]: stopped(true) old = false
01-15 15:43:27.696 26679 26679 D ViewRootImpl@7e01ee7[ReceiveExternalFilesActivity]: WindowStopped on com.nextcloud.client/com.owncloud.android.ui.activity.ReceiveExternalFilesActivity set to true
01-15 15:43:27.696 26679 26679 D ReceiveExternalFilesActivity: onStop() ending
01-15 15:43:27.709 26679 26679 D ReceiveExternalFilesActivity: onDestroy() ending
01-15 15:43:27.711 26679 26679 I WindowManager: WindowManagerGlobal#removeView, ty=2, view=DecorView@92a3f28[ReceiveExternalFilesActivity], caller=android.view.WindowManagerGlobal.removeView:628 android.view.WindowManagerImpl.removeViewImmediate:208 android.app.Dialog.dismissDialog:801
01-15 15:43:27.712 26679 26679 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda19@2ffc258
01-15 15:43:27.713 26679 26679 I ViewRootImpl@72b4441[ReceiveExternalFilesActivity]: dispatchDetachedFromWindow
01-15 15:43:27.715 26679 26679 D InputTransport: Input channel destroyed: '6ec4106', fd=176
01-15 15:43:27.716 26679 26679 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=falsecallback=android.view.ViewRootImpl$$ExternalSyntheticLambda19@c46bad
01-15 15:43:27.717 26679 26679 D AutofillManager: view not autofillable - not passing ime action check
01-15 15:43:27.720 26679 26679 I ViewRootImpl@7e01ee7[ReceiveExternalFilesActivity]: dispatchDetachedFromWindow
01-15 15:43:27.722 26679 26679 D InputTransport: Input channel destroyed: 'dda21c ', fd=137
01-15 15:43:27.723 26679 26679 V OperationsService: Destroying service
01-15 15:43:27.933 26679 26679 D MainApp : APP IN BACKGROUND
01-15 15:43:31.563 26679 26828 D ProfileInstaller: Skipping profile installation for com.nextcloud.client
01-15 15:43:36.354 26679 26754 E GoogleApiManager: Failed to get service from broker.
01-15 15:43:36.354 26679 26754 E GoogleApiManager: java.lang.SecurityException: Unknown calling package name 'com.google.android.gms'.
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Parcel.createExceptionOrNull(Parcel.java:3069)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Parcel.createException(Parcel.java:3053)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Parcel.readException(Parcel.java:3036)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Parcel.readException(Parcel.java:2978)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at apef.a(:com.google.android.gms@245034029@24.50.34 (190400-713002902):36)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at apcm.z(:com.google.android.gms@245034029@24.50.34 (190400-713002902):143)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at aokj.run(:com.google.android.gms@245034029@24.50.34 (190400-713002902):54)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Handler.handleCallback(Handler.java:958)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Handler.dispatchMessage(Handler.java:99)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at bvmf.my(:com.google.android.gms@245034029@24.50.34 (190400-713002902):1)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at bvmf.dispatchMessage(:com.google.android.gms@245034029@24.50.34 (190400-713002902):5)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Looper.loopOnce(Looper.java:230)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.Looper.loop(Looper.java:319)
01-15 15:43:36.354 26679 26754 E GoogleApiManager: at android.os.HandlerThread.run(HandlerThread.java:67)
01-15 15:43:36.490 26679 26690 W extcloud.client: Cleared Reference was only reachable from finalizer (only reported once)
01-15 15:43:36.534 26679 26692 W System : A resource failed to call AbstractCursor.close.
01-15 15:43:36.534 26679 26692 W System : A resource failed to call CursorWrapperInner.close.
01-15 15:43:37.277 26679 26837 D ContentObserverWork: File-sync Content Observer detected files change
01-15 15:43:37.443 26679 26838 D MediaProvider: Reading images for ... (censored)
01-15 15:43:38.306 26679 26722 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=eae58242-d7ab-4a6a-8fc3-4c219a283f40, tags={ com.nextcloud.client.jobs.MediaFoldersDetectionWork, *, name:immediate_media_folder_detection, timestamp:1736952217280, class:MediaFoldersDetectionWork } ]
01-15 15:43:38.328 26679 26679 D Choreographer: CoreRune.SYSPERF_ACTIVE_APP_BBA_ENABLE : stop animation in background states
01-15 15:43:46.525 26679 26741 D OpenGLRenderer: RenderThread::destroyRenderingContext()
```
### Server error logs
```bash
46.188.234.244 - pg [15/Jan/2025:15:10:26 +0100] "PROPFIND /remote.php/dav/files/pg/Documents/ HTTP/1.1" 207 1726 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.30.7"
46.188.234.244 - pg [15/Jan/2025:15:10:26 +0100] "GET /ocs/v2.php/apps/files_sharing/api/v1/shares?path=%2FDocuments%2F&reshares=true&subfiles=true HTTP/1.1" 200 829 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.30.7"
```
### Additional information
Nextcloud is running in a Kubernetes cluster behind:
- a Traefik ingress controller with this Ingress config:
``` yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nextcloud
annotations:
kubernetes.io/ingressClassName: traefik
traefik.ingress.kubernetes.io/router.middlewares: nextcloud-hsts@kubernetescrd
traefik.ingress.kubernetes.io/router.entrypoints: https-external
traefik.ingress.kubernetes.io/router.tls: "true"
spec:
rules:
- host: "nextcloud.mydomain.com"
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nextcloud
port:
number: 8080
```
- and HAProxy (external to the cluster) with this config:
```
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log stdout syslog notice
stats socket /var/run/haproxy.sock mode 600 level admin
lua-load /etc/haproxy/lib/cors.lua
lua-prepend-path /usr/lib/crowdsec/lua/haproxy/?.lua
lua-load /usr/lib/crowdsec/lua/haproxy/crowdsec.lua # path to crowdsec.lua
setenv CROWDSEC_CONFIG /etc/crowdsec/bouncers/crowdsec-haproxy-bouncer.conf
httpclient.ssl.verify none
httpclient.resolvers.id cloudflare
#---------------------------------------------------------------------
# Common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
log global
timeout client 300s
timeout server 300s
timeout connect 5s
timeout http-request 5s
default-server resolvers host-dns
#---------------------------------------------------------------------
# Resolvers
#---------------------------------------------------------------------
resolvers host-dns
parse-resolv-conf
hold valid 120s
resolve_retries 3
timeout resolve 1s
timeout retry 1s
#---------------------------------------------------------------------
# External frontends
#---------------------------------------------------------------------
frontend external-https
bind INTERNAL_IP0:80
bind INTERNAL_IP0:443 ssl crt /etc/haproxy/certs
log stdout local0 info
mode http
option httplog
option forwardfor
... lines related to captcha verification for Crowdsec ...
# HTTP to HTTPS redirect, HSTS
http-request redirect scheme https code 301 unless { ssl_fc }
http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
option forwardfor header X-Real-IP
http-request set-header X-Real-IP %[src]
default_backend external-kube-https
#---------------------------------------------------------------------
# External backends
#---------------------------------------------------------------------
backend external-kube-https
mode http
server kube-node-0 INTERNAL_IP1:PORT ssl verify none check port PORT inter 5s rise 2 fall 2
server kube-node-1 INTERNAL_IP2:PORT ssl verify none check port PORT inter 5s rise 2 fall 2
```
Contributor guide
Assessment
This issue has not been assessed yet.