nextcloud / nextcloud/android

setting localstorage.umask causes uploads to fail with "folder error" due to folder creation (year / date) failing

Open
#13,673 4 comments 0 reactions 0 assignees View on GitHub
0. Needs triage bug feature: auto upload feature: transfers stable-3.29
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. Set localstorage.umask to e.g. 002 / 0002 in your nextcloud instance, restart nextcloud
2. make sure target upload folder is empty, i.e not containing existing year/date folder
3. make sure that upload configuration is set to put in folder year/month
4. take a picture with your android app and make sure that nextcloud app tries to upload it
5. observe "folder error" in nextcloud app upload

### Expected behaviour

When setting localstorage.umask to e.g. 002/0002, uploads from android app should continue to work and the required year/month folders should be created.

### Actual behaviour

Uploads fail when localstorage.umask is set to 002 or 0022 with folder error. No errors visible in web gui of nextcloud. Creating folder from webgui of nextcloud works fine and seems to observe the new umask.

If the target folder (e.g. 2024/10) exist, the file upload works. However the upload seems to fail with creating the errors.

### Android version

Android 13 with July 2024 sec update

### Device brand and model

Samsung A32

### Stock or custom OS?

Stock

### Nextcloud android app version

3.29.2

### Nextcloud server version

29.0.7

### Using a reverse proxy?

Yes

### Android logs

```
0-01 21:47:25.791 13097 13097 V UploadsStorageManager: getUploads() returning 0 (0) rows after reading 1 pages
10-01 21:47:25.793 13097 13393 D UploadFileOperation: Checking name collision in server
10-01 21:47:25.794 13097 13393 D OwnCloudClient #0: REQUEST HEAD /somewhere/remote.php/dav/files/someuser/photo/temp/2024/10/20241001_214703.jpg
10-01 21:47:25.831 13097 13393 D ExistenceCheckRemoteOperation: Existence check for https://someserver.com/somewhere/remote.php/dav/files/someuser/photo/temp/2024/10/20241001_214703.jpg targeting for existence finished with HTTP status 404(FAIL)
10-01 21:47:25.836 13097 13393 D UploadsStorageManager: Retrieve job com.owncloud.android.db.OCUpload@1ecf9b7 for id 1
10-01 21:47:25.836 13097 13393 V UploadsStorageManager: Updating /storage/emulated/0/DCIM/Camera/20241001_214703.jpg with status=UPLOAD_IN_PROGRESS
10-01 21:47:25.843 13097 13393 D UploadsStorageManager: updateUpload returns with: 1 for file: /storage/emulated/0/DCIM/Camera/20241001_214703.jpg
10-01 21:47:25.843 13097 13393 D UploadsStorageManager: notifyObserversNow
10-01 21:47:25.843 13097 13393 D OwnCloudClient #0: REQUEST PUT /somewhere/remote.php/dav/files/someuser/photo/temp/2024/10/20241001_214703.jpg
10-01 21:47:26.544 13097 13393 E UploadFileOperation: Upload of /storage/emulated/0/DCIM/Camera/20241001_214703.jpg to /photo/temp/2024/10/20241001_214703.jpg: Local file does not exist
10-01 21:47:26.545 13097 13393 D UploadsStorageManager: updateDatabaseUploadResult uploadResult: RemoteOperationResult{mSuccess=false, mHttpCode=404, mHttpPhrase='Not Found', mException=null, mCode=FILE_NOT_FOUND, message='null', getLogMessage='Local file does not exist'} upload: com.owncloud.android.operations.UploadFileOperation@2748f90
10-01 21:47:26.549 13097 13393 V UploadsStorageManager: Updating /storage/emulated/0/DCIM/Camera/20241001_214703.jpg with status:UPLOAD_FAILED and result:FOLDER_ERROR (old:/storage/emulated/0/DCIM/Camera/20241001_214703.jpg status:UPLOAD_IN_PROGRESS result:-1)
10-01 21:47:26.549 13097 13393 V UploadsStorageManager: Updating /storage/emulated/0/DCIM/Camera/20241001_214703.jpg with status=UPLOAD_FAILED
10-01 21:47:26.585 13097 13393 D UploadsStorageManager: updateUpload returns with: 1 for file: /storage/emulated/0/DCIM/Camera/20241001_214703.jpg
10-01 21:47:26.585 13097 13393 D UploadsStorageManager: notifyObserversNow
10-01 21:47:26.586 13097 13393 D FileUploadWorker: NotifyUploadResult with resultCode: FILE_NOT_FOUND
10-01 21:47:26.596 13097 13097 D UploadListAdapter: loadUploadItemsFromDb
10-01 21:47:26.596 13097 13393 D UploadsStorageManager: QUERY: (( status==0 OR last_result==9 OR last_result==13 OR last_result==11 OR last_result==14 ) AND account_name== ?) AND _id > ? ROWID: 1
10-01 21:47:26.599 13097 13097 D UploadsStorageManager: QUERY: ( status==0 OR last_result==9 OR last_result==13 OR last_result==11 OR last_result==14 ) AND account_name== ? ROWID: -1
```

### Server error logs

```bash
no error in the logging section of nextcloud webgui during that time. I can provide other logs if needed.
```

### Additional information

- target upload dir is external storage
- the folders 2024/10 would have to be created by the upload in this example, i.e. the photo/temp dir was empty and did not contain year or month
- the upload is successful if the folders exist (2024/10 in my example), but the fail with folder error if they would have to be created during the upload
- removing localstorage.umask from config.php make uploads / folder creation work again

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.