Attach/Send files to messages does not work for fresh users
Steps to reproduce
- Create a new user
- Use this user in Android Talk
- Try to send a file (e.g image) in a Message
To fix it, there are two options. After those steps it is possible to send images from Android as well.
- Receive a message including an image
- Login to web or iOS and send a message/file in Talk there
Expected behaviour
The file is sent.
Actual behaviour
- File/Message is not sent
- native Android notification "Failure: Failed to upload: imagename.jpg" is shown
Device brand and model
Moto g84 5G
Android version
14
Nextcloud Talk app version
19.0.1
Nextcloud server version
29.0.4
Talk version
19.0.7
Custom Signaling server configured
None
Custom TURN server configured
None
Custom STUN server configured
None
Android logs
No response
Server log
No response
Additional information
Is reproducable on different Android phones.
iirc this might happen due to the attachments folder on server that is not yet created. Do you know if the same scenario also fails on iOS?
yes this happened to me also and the fix options i did was the same as @woolfg mentioned
@Ivansss @SystemKeeper is it the same behavior on iOS?
We check the status code for the missing attachment folder and create it in that case:
https://github.com/nextcloud/talk-ios/blob/52a6f3de3c6859f2c8fc7d2cf5cda3f0da63d896/NextcloudTalk/NCAPIController.m#L1930-L1952
https://github.com/nextcloud/talk-ios/blob/52a6f3de3c6859f2c8fc7d2cf5cda3f0da63d896/ShareExtension/ShareConfirmationViewController.swift#L660-L668
is it the same behavior on iOS?
I can reproduce the issue in Talk iOS as well as using the web app.
Sharing the file request fails with a 500 internal sever error:
Failed to share file. Error: Request failed: internal server error (500)
So even the file is correctly shared, the server replies with a 500 probably beacause the Talk folder hasn't been created for that new fresh user yet.
So this seems to be more like a server issue.
is it the same behavior on iOS?
for me in worked on web and iOS as this was my workaround "Login to web or iOS and send a message/file in Talk there" to fix the problem.
The issue reported in my previous comment https://github.com/nextcloud/talk-android/issues/4053#issuecomment-2577438927 was unrelated with this issue. This issue might be related with the attachment folder as @SystemKeeper reported here: https://github.com/nextcloud/talk-android/issues/4053#issuecomment-2577254140
TODO:
- try upload
- if it fails, use DAV propfind to check if folder exists
- if it doesn't exist (404 or 409), create folder with mkCol
also see:
- https://github.com/nextcloud/talk-android/blob/9b3a11569a8175d3591e3c4007370fc5c479ad02/app/src/main/java/com/nextcloud/talk/upload/chunked/ChunkedFileUploader.kt#L98
- https://docs.nextcloud.com/server/latest/developer_manual/client_apis/WebDAV/basic.html#creating-folders-rfc4918