nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.89k stars 862 forks source link

Auto upload to external storages not working with IOS App v4.1.0.17 and later #1788

Open mrtnd opened 2 years ago

mrtnd commented 2 years ago

Steps to reproduce

  1. Update the App to the lastest version. In my case 4.1.0.17
  2. Open the App - singed out?
  3. Photos are uploaded automatically ?

Expected behaviour

After the update I should open the app and land on the FILES tab. Any new Photos are uploaded automatically. Which is the normal behavior.

Actual behaviour

After the update I was singed out. Auto Upload was off. After manually enabling it, new Photos are recognized but are not uploaded automatically. Auto upload was working fine with the last version. I think it was 4.0.6

Upload Progress can be seen under More -> Transfers. It tries to upload the photos every couple of seconds, but with no success. It says "Error Waiting for upload"

I should mention that the location where photos are uploaded is a mapped folder (as a volume) into the docker container. But like I said, it was working before.

Logs

"PUT /remote.php/dav/files/share/photos/user/21-12-01%2012-29-25%202332.jpg HTTP/2.0" 404 182 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"

"PUT /remote.php/dav/files/share/photos/user/21-12-01%2012-29-25%202332.jpg HTTP/2.0" 404 182 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.1.0"

Environment data

iOS version:
OS 15.1

Nextcloud iOS app version: 14.1.0.17

Server operating system: docker. it runs on ubuntu

Web server: nginx

Database: postgres 13.5

Nextcloud version: 22.2.3

chrissi5120 commented 2 years ago

Had the exact same error with Nexcloud IOS-APP 4.1.0.17 Nextcloud Server 22.2.0 External Storage (locally mounted into docker container)

had to delete pending uploads and redefine target drive to get it working

mrtnd commented 2 years ago

Had the exact same error with Nexcloud IOS-APP 4.1.0.17 Nextcloud Server 22.2.0 External Storage (locally mounted into docker container)

had to delete pending uploads and redefine target drive to get it working

Thanks for the reply. I tried that already... didn't solve the issue for me.

I updated the server to 23.0.0 hoping that it will get fixed, but that didn't help either.

I have an Android device that uploads photos to the same location without problems...

It seems that the iOS client has a problem with external storages. Auto Upload to the default destination (/Photos) works fine.

meichthys commented 2 years ago

@mrtnd I see you closed this issue. Did you find a fix? I'm facing the same issue but haven't found a workaround yet unless i upload to a non 'external storage' directory: image

mrtnd commented 2 years ago

@meichthys I didn't realize that it was closed until now. It must have happend by accident. It is open now

I have not found a solution. the newest server (23.0.0) and newest app (4.2.0) don't fix the issue.

Two versions ago had no issue uploading to external storages. Downgrading would be a solution?

muzzah commented 2 years ago

Having the same issues. iOS 4.1.0.17, server is 23.0.0. (Docker)

Images and videos in my camera roll wont upload with the same error message.

meichthys commented 2 years ago

@muzzah Are you uploading to an "External Storage"?

chrissi5120 commented 2 years ago

@mrtnd I see you closed this issue. Did you find a fix? I'm facing the same issue but haven't found a workaround yet unless i upload to a non 'external storage' directory: image

Have you tried to ditch this uploads and create some new "samples"?

I could not figure out how to upload the files which were showing up with an error, but new uploads were not affected.

meichthys commented 2 years ago

@chrissi5120 I'm not sure what you mean by new "samples" but for me, any new photos taken have the same issue. Sometimes they do actually upload but usually they still show the same error in the app.

mrtnd commented 2 years ago

@chrissi5120 i tried everything..... turning autoupload off and on again and again, redefining target location, deleting cache, server update... I even reinstalled the App. Nothing. I cannot confirm that some photos are uploaded and some are not because I didn't want to keep track on that. I just set it to it's default path. That works.

trashcoder commented 2 years ago

Same here with App Version 4.2.0.5 and Server 22.2.3.

Some images are not uploaded when i activated "upload complete storage", even when i leave to default file path. I just switched on to make subfolders for every month and year.

JmbFountain commented 2 years ago

Can reproduce this with app version 4.2.0.5 and server 23.0.0.0.

The Images are uploaded to Nextcloud-local storage just fine, but not to remote Storage (SMB). I get the following Error message from Nextcloud:

{
  "reqId": "4Jpd6FBUlz3Wyb7n9ogZ",
  "level": 3,
  "time": "2022-01-28T14:36:55+00:00",
  "remoteAddr": "",
  "user": "admin",
  "app": "no app in context",
  "method": "PUT",
  "url": "/index.php/apps/files_external/globalstorages/1",
  "message": "Error while getting file info",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
  "version": "23.0.0.10",
  "exception": {
    "Exception": "Icewind\\SMB\\Exception\\ForbiddenException",
    "Message": "Invalid request for /IT_SLK (ForbiddenException)",
    "Code": 1,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
        "line": 67,
        "function": "fromMap",
        "class": "Icewind\\SMB\\Exception\\Exception",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
        "line": 84,
        "function": "handleError",
        "class": "Icewind\\SMB\\Native\\NativeState",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php",
        "line": 338,
        "function": "testResult",
        "class": "Icewind\\SMB\\Native\\NativeState",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",
        "line": 305,
        "function": "getxattr",
        "class": "Icewind\\SMB\\Native\\NativeState",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",
        "line": 43,
        "function": "getAttribute",
        "class": "Icewind\\SMB\\Native\\NativeShare",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeFileInfo.php",
        "line": 69,
        "function": "stat",
        "class": "Icewind\\SMB\\Native\\NativeFileInfo",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php",
        "line": 114,
        "function": "getSize",
        "class": "Icewind\\SMB\\Native\\NativeFileInfo",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
        "line": 189,
        "function": "stat",
        "class": "Icewind\\SMB\\Native\\NativeShare",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
        "line": 342,
        "function": "getFileInfo",
        "class": "OCA\\Files_External\\Lib\\Storage\\SMB",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Storage/Common.php",
        "line": 458,
        "function": "stat",
        "class": "OCA\\Files_External\\Lib\\Storage\\SMB",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php",
        "line": 717,
        "function": "test",
        "class": "OC\\Files\\Storage\\Common",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/MountConfig.php",
        "line": 130,
        "function": "test",
        "class": "OCA\\Files_External\\Lib\\Storage\\SMB",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/Controller/StoragesController.php",
        "line": 270,
        "function": "getBackendStatus",
        "class": "OCA\\Files_External\\MountConfig",
        "type": "::",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/files_external/lib/Controller/GlobalStoragesController.php",
        "line": 187,
        "function": "updateStorageStatus",
        "class": "OCA\\Files_External\\Controller\\StoragesController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 217,
        "function": "update",
        "class": "OCA\\Files_External\\Controller\\GlobalStoragesController",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 126,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 157,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 1006,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php",
    "Line": 44,
    "CustomMessage": "Error while getting file info"
  }
}
meichthys commented 2 years ago

@mrtnd Could you please update the title of this issue to indicate that the issue is related to External Storage? (I've closed my duplicate issue: #1828)

meichthys commented 2 years ago

When i see this issue happen on iOS, i also see the following in the Nextcloud logs:

[webdav] Fatal: Storage with mount id 2 is not available

PUT /remote.php/dav/files/my_user/Photos/22-01-29%2000-58-22%208040.jpg

image

mrtnd commented 2 years ago

When i see this issue happen on iOS, i also see the following in the Nextcloud logs:

[webdav] Fatal: Storage with mount id 2 is not available

PUT /remote.php/dav/files/my_user/Photos/22-01-29%2000-58-22%208040.jpg

image

I have no such errors in the log. Are you able to browse the external storage from within the app ? Is it properly shown?

meichthys commented 2 years ago

The android app had a similar issue (https://github.com/nextcloud/android/issues/468). It looks like it may be a timeout issue or a contenttype issue that could be fixed by checking for an empty content type of ;.

mrtnd commented 2 years ago

Yeah it all started with v4.1.0…. It was working fine with the version before that. Is there a way to downgrade?

mrtnd commented 2 years ago

Hi all any news regarding this issue?

JmbFountain commented 2 years ago

@mrtnd no, you can't really downgrade apps on iOS, unless you have a developer account or some MDM stuff.

mrtnd commented 2 years ago

Hi @JmbFountain that is really disappointing... cuz it was working before v4.1.0. I have an android client that is uploading to external storages just fine. So it must be a client issue, not server.

joinke commented 2 years ago

There was a question whether manually uploading a file to those remote storage works. Answer for me is YES 👍 (iOS 4.2.2 and NC 22.2.5 ) .

Manual Upload :

[22/Feb/2022:09:41:50 +1100] "PUT /nextcloud/remote.php/dav/files/Johan/piwigo_1/Johan/2022/HDPE_A4.pdf HTTP/1.1" 201 950 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2" [22/Feb/2022:09:41:56 +1100] "GET /nextcloud/index.php/core/preview.png?file=piwigo_1/Johan/2022/HDPE_A4.pdf&x=1024&y=1024&a=1&mode=cover HTTP/1.1" 200 506464 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2"

The "Auto Upload" however fails (http 409 : conflict with current status of resource

[22/Feb/2022:09:52:19 +1100] "MKCOL /nextcloud/remote.php/dav/files/piwigo_1/Johan HTTP/1.1" 409 822 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2" [22/Feb/2022:09:52:19 +1100] "MKCOL /nextcloud/remote.php/dav/files/piwigo_1/Johan/2022 HTTP/1.1" 409 822 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2" [22/Feb/2022:09:52:20 +1100] "MKCOL /nextcloud/remote.php/dav/files/piwigo_1/Johan/2022/02 HTTP/1.1" 409 822 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2" [22/Feb/2022:09:52:21 +1100] "PUT /nextcloud/remote.php/dav/files/piwigo_1/Johan/2022/02/IMG_4449.JPG HTTP/1.1" 404 862 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/4.2.2"

joinke commented 2 years ago

For those who have control on underlying OS ...(Linux) A workaround which works on NC 23 (not tested on NC 22) cd <data-directory> (data-directory in /var/www/nextcloud/config/config.php) (default) mkdir <myexternaldir> mount --bind <my-real-external-storage-dir> <data-directory>/<myexternaldir> sudo -u www-data php occ files:scan --all (replace www-data with owner of nextcloud)

JmbFountain commented 2 years ago

If I read this correctly, your workaround is to mount the file server on the Nextcloud VM and then write there. However, this is kind of a pain in the back with the amount of ACLs these File Servers have on them in Enterprise environments. Our eventual goal is to replace most Windows Workstations with either Terminals that just open a webbrowser or Tablets. Once we migrated there, we want to just get rid of the Windows File servers.

@mrtd I pinged a colleague of mine who is responsible for Mobile Deployments, we plan to push an old Version of this App using MDM and check if it solves the problem. If yes, we'll try to fork, fix and upstream

meichthys commented 2 years ago

If yes, we'll try to fork, fix and upstream

Please keep us updated!

mrtnd commented 2 years ago

@MrTD I pinged a colleague of mine who is responsible for Mobile Deployments, we plan to push an old Version of this App using MDM and check if it solves the problem. If yes, we'll try to fork, fix and upstream

Yes that would be great. Please keep us posted.

joinke commented 2 years ago

@JmbFountain indeed . mounted a remote filesystem using in this case smb on the OS. Then a bind mount to a subdirectory that nc has access to. It's a lot of workaround and agree with the hassle of file permissions