Server: SFTP storage seems broken since 19.0.0.RC1

Created on 14 May 2020  Â·  20Comments  Â·  Source: nextcloud/server

Steps to reproduce

  • Set up a storage sftp.
  • Check your connection.
  • Go to to storage..
  • Try to download a file.

Captura 2020-05-14 10 38 52

Expected behaviour

  • Set up a storage sftp.
  • Check your connection.
  • Go to to storage..
  • Try to download a file.
  • Download file..

Actual behaviour

  • Set up a storage sftp.
  • Check your connection.
  • Go to to storage..
  • Try to download a file.
  • ERROR PAGE WITH NO MORE DETAILS

Captura 2020-05-14 10 37 17

Server configuration detail

Operating system: Linux 5.6.8-200.fc31.x86_64 #1 SMP Wed Apr 29 19:10:01 UTC 2020 x86_64

Webserver: Apache/2.4.43 (Fedora) OpenSSL/1.1.1g (fpm-fcgi)

Database: mysql 10.3.22

PHP version:

7.3.17
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, cgi-fcgi, bcmath, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, json, ldap, exif, mysqlnd, PDO, Phar, posix, shmop, SimpleXML, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, mcrypt, mysqli, pdo_mysql, pdo_sqlite, wddx, xmlreader, apcu, igbinary, imagick, msgpack, pcov, smbclient, zip, pdlib, redis, libsmbclient, Zend OPcache, xdebug

Nextcloud version: 19.0.0 RC1, 19.0.0 RC2

Updated from an older Nextcloud/ownCloud or fresh install: Nextcloud 18.0.4

Where did you install Nextcloud from: unknown

Signing status

Array
(
)

List of activated apps

Enabled:
 - accessibility: 1.5.0
 - activity: 2.12.0
 - calendar: 2.0.3
 - cloud_federation_api: 1.2.0
 - comments: 1.9.0
 - contacts: 3.3.0
 - contactsinteraction: 1.0.0
 - dav: 1.15.0
 - deck: 1.0.0
 - dropit: 0.4.0
 - facerecognition: 0.6.0
 - federatedfilesharing: 1.9.0
 - federation: 1.9.0
 - files: 1.14.0
 - files_external: 1.10.0
 - files_pdfviewer: 1.8.0
 - files_rightclick: 0.16.0
 - files_sharing: 1.11.0
 - files_trashbin: 1.9.0
 - files_versions: 1.12.0
 - issuetemplate: 0.6.0
 - logreader: 2.4.0
 - lookup_server_connector: 1.7.0
 - nextcloud_announcements: 1.8.0
 - notes: 3.3.0
 - notifications: 2.7.0
 - oauth2: 1.7.0
 - password_policy: 1.9.1
 - photos: 1.1.0
 - previewgenerator: 2.3.0
 - privacy: 1.3.0
 - provisioning_api: 1.9.0
 - quicknotes: 0.2.4
 - richdocuments: 3.6.0
 - serverinfo: 1.9.0
 - settings: 1.1.0
 - sharebymail: 1.9.0
 - support: 1.2.1
 - survey_client: 1.7.0
 - text: 3.0.1
 - theming: 1.10.0
 - twofactor_backupcodes: 1.8.0
 - updatenotification: 1.9.0
 - viewer: 1.3.0
 - workflowengine: 2.1.0
Disabled:
 - admin_audit
 - bruteforcesettings
 - documentserver_community
 - encryption
 - files_videoplayer
 - firstrunwizard
 - mail
 - maps
 - metadata
 - onlyoffice
 - recommendations
 - social
 - spreed
 - systemtags
 - user_ldap

Configuration (config/config.php)

{
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "delellis.com.ar",
        "192.168.1.123"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "http:\/\/delellis.com.ar",
    "htaccess.RewriteBase": "\/",
    "dbtype": "mysql",
    "version": "19.0.0.10",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "maintenance": false,
    "mail_smtpmode": "smtp",
    "mail_smtpauthtype": "PLAIN",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "25",
    "simpleSignUpLink.shown": false,
    "enabledPreviewProviders": [
        "OC\\Preview\\PNG",
        "OC\\Preview\\JPEG",
        "OC\\Preview\\GIF",
        "OC\\Preview\\BMP",
        "OC\\Preview\\XBitmap",
        "OC\\Preview\\MP3",
        "OC\\Preview\\TXT",
        "OC\\Preview\\PDF",
        "OC\\Preview\\MarkDown",
        "OC\\Preview\\Movie",
        "OC\\Preview\\OpenDocument",
        "OC\\Preview\\MSOfficeDoc",
        "OC\\Preview\\MSOffice2003",
        "OC\\Preview\\MSOffice2007"
    ],
    "loglevel": 0,
    "updater.release.channel": "beta",
    "app_install_overwrite": [
        "calendar",
        "deck",
        "facerecognition",
        "viewer",
        "contacts",
        "dropit",
        "social",
        "mail",
        "spreed",
        "issuetemplate"
    ],
    "has_rebuilt_cache": true,
    "theme": "",
    "updater.secret": "***REMOVED SENSITIVE VALUE***"
}

Are you using external storage, if yes which one: sftp, local

Are you using encryption:

Are you using an external user-backend, if yes which one:

Client configuration

Browser: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0

Operating system: Fedora 32

Logs

Web server error log


Nextcloud log

[PHP] Error: fopen(sftpread://home/matias/Imágenes/The Big Bang Theory//5cdede8493a1523698058b33.jpg): failed to open stream: "OCA\Files_External\Lib\Storage\SFTPReadStream::stream_open" call failed at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#378

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=5urxlp3qumh
from 192.168.1.163 by matias at 2020-05-14T13:11:09+00:00

[webdav] Fatal: Sabre\DAV\Exception\ServiceUnavailable: Could not open file at <<closure>>

0. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 90
   OCA\DAV\Connector\Sabre\File->get()
1. /var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpGet(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
2. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 474
   Sabre\DAV\Server->emit("method:GET", [Sabre\HTTP\Requ ... }])
3. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 251
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
4. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 319
   Sabre\DAV\Server->start()
5. /var/www/html/nextcloud/apps/dav/appinfo/v1/webdav.php line 82
   Sabre\DAV\Server->exec()
6. /var/www/html/nextcloud/remote.php line 167
   require_once("/var/www/html/n ... p")

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=5urxlp3qumh
from 192.168.1.163 by matias at 2020-05-14T13:11:09+00:00

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

0. Needs triage 19-feedback bug external storage

Most helpful comment

Thanks for the info, I'll probably come up with some more debug patches after the weekend

All 20 comments

Thank you for taking the time to report a problem :+1:

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg

sftpread://home/matias/Imágenes/The Big Bang Theory//5cdede8493a1523698058b33.jpg

Is /SFTP in Nextcloud => /home/matias/Imágenes/The Big Bang Theory folder? If not it looks like we are loosing the folder somewhere. Could be a regression from https://github.com/nextcloud/server/pull/19822.

Is /SFTP in Nextcloud => /home/matias/Imágenes/The Big Bang Theory folder?

Yes.. It is a folder that I used regularly to test the external storage of the Facecognition application.. https://github.com/matiasdelellis/facerecognition/issues/212
It worked on NC18, update to NC19 and get this error ..

[matias@nube nextcloud]$ ls -la /home/matias/Imágenes/The\ Big\ Bang\ Theory/
total 10248
drwxr-xr-x  2 matias apache  20480 abr  6 18:27  .
drwxr-xr-x. 4 matias apache   4096 dic  6 18:58  ..
-rw-r--r--  1 matias apache 160749 nov 21 00:52  104316104-_sites-default-files-images-104316104-BBT.jpg
-rw-r--r--  1 matias apache 958301 nov 21 00:52  109815_0959b.jpg
-rw-r--r--  1 matias apache  84980 nov 21 00:52  10-mejores-episodios-big-bang-theory.jpg
-rw-r--r--  1 matias apache 135272 nov 21 00:52  111951_0234b.jpg
-rw-r--r--  1 matias apache  50088 dic  6 22:21  114995wb0969b-pinkjpg.jpeg
-rw-r--r--  1 matias apache 730462 nov 21 00:52  150426161906-big-bang-theory-couch-full-169.jpg
-rw-r--r--  1 matias apache  72066 dic  6 22:23  1537538523-the-big-bang-theory-penny.jpg
-rw-r--r--  1 matias apache 119517 nov 21 00:52  1552339607-394108799279576907340191658188337845895168n.jpg
-rw-r--r--  1 matias apache 193983 nov 21 00:52  212310.jpg
-rw-rw-r--  1 matias apache 235006 dic  7 12:02  217853.jpg
-rw-rw-r--  1 matias apache  87106 dic  7 21:04  49866289ce17015ce2ce407336c390a9.jpg
-rw-rw-r--  1 matias apache  79190 dic  6 23:31  5cdede8493a1523698058b33.jpg
-rw-rw-r--  1 matias apache  99533 dic  6 22:28  636410816143109194-NICK.6.-Sheldon-Jim-Parsons-and-Amy-Mayim-Bialik-in-The-Big-Bang-Theory---CBS-Chuck-Lorre-Productions.jpg
-rw-r--r--  1 matias apache 255622 nov 21 00:52  784680tbbtjpg.jpg
-rw-r--r--  1 matias apache 986649 nov 21 00:52  bbt.jpg
-rw-r--r--  1 matias apache 459199 nov 21 00:52 'Big Bang Theory Sheldon and Amy s12.jpg.2018-09-24T11 57 46+12 00.jpg'
-rw-r--r--  1 matias apache 152001 nov 21 00:52  Big-Bang-Theory-1280x640.jpg
-rw-r--r--  1 matias apache 199776 nov 21 00:52  big-bang-theory-cast-jim-parsons-kaley-cuoco-20008437-1280x0.jpg
-rw-r--r--  1 matias apache 303576 nov 21 00:52  big-bang-theory-esports-1560x880.jpg
-rw-r--r--  1 matias apache 102030 nov 21 00:52  el-final-de-the-big-bang-theory-gratis-en-el-monumento-a-la-revolucion.jpg
-rw-r--r--  1 matias apache 143548 nov 21 00:52  El-síndrome-de-Estocolmo-cierra-el-trama-del-Tráiler-final-The-Big-Bang-Theory-.jpg
-rw-r--r--  1 matias apache 163641 nov 21 00:52  EPKOPT2KWZCIJKBVRLNE5XQKAQ.jpg
-rw-r--r--  1 matias apache 154627 nov 21 00:52  final-big-bang-theory.jpg
-rw-r--r--  1 matias apache 168303 nov 21 00:52  GS18P49F1_95434.jpg
-rw-r--r--  1 matias apache 190741 nov 21 00:52 'http _prod-upp-image-read.ft.com_35773490-d956-11e9-9c26-419d783e10e8.jpg'
-rw-r--r--  1 matias apache 540240 nov 21 00:52  https___i.cdn_.tbs_.com_assets_images_2017_03_BigBangTheory-2048x1536.jpg
-rw-rw-r--  1 matias apache  60250 dic  6 22:21  Kaley-Cuoco-The-Big-Bang-Theory.jpg
-rw-r--r--  1 matias apache 138018 nov 21 00:52  maxresdefsault.jpg
-rw-r--r--  1 matias apache 238314 nov 21 00:52  MV5BY2FmZTY5YTktOWRlYy00NmIyLWE0ZmQtZDg2YjlmMzczZDZiXkEyXkFqcGdeQXVyNjg4NzAyOTA@._V1_.jpg
-rw-rw-r--  1 matias apache  64591 dic  6 22:38  Sheldon-Cooper-Green-Lantern-Power-Battery-Hal-Jordan-Power-Ring-in-The-Big-Bang-Theory-Scene.jpg
-rw-r--r--  1 matias apache 821031 nov 21 00:52  the-big-bang-theory-1567767144.jpg
-rw-rw-r--  1 matias apache 604703 dic  8 13:52  The-Big-Bang-Theory-1920.jpg
-rw-rw-r--  1 matias apache 446600 dic  8 13:43  the-big-bang-theory3.jpg
-rw-r--r--  1 matias apache 194831 nov 21 00:52  the_big_bang_theory_bts_publicity-h_2019.jpg
-rw-r--r--  1 matias apache 123974 nov 21 00:52  the-big-bang-theory-e1499507396364.jpg
-rw-r--r--  1 matias apache 339086 nov 21 00:52  the-big-bang-theorye.jpg
-rw-r--r--  1 matias apache 159788 nov 21 00:52  the-big-bang-theory.jpg
-rw-r--r--  1 matias apache 110492 nov 21 00:52  [email protected]
-rw-rw-r--  1 matias apache 183775 dic  7 21:03  the_big_bang_theory_s10e22_still.jpg
-rw-r--r--  1 matias apache  69998 nov 21 00:52  The-Big-Bang-Theory-Thanksgiving.jpg

Yes..

We are not loosing the folder then ;)

Confirming issue on 19 RC2.

Attached is a complete error log with every error that shows up in tail -f.

stuff3.txt

I can't reproduce this issue

Can you try editing apps/files_external/lib/Lib/Storage/SFT.php line 373 till 384, removing the special cases for read write. Making the resulting code be

            switch ($mode) {
                case 'r':
                case 'rb':
                case 'w':
                case 'wb':
                case 'a':
                case 'ab':
                case 'r+':
                case 'w+':
                case 'wb+':
                case 'a+':
                case 'x':
                case 'x+':
                case 'c':
                case 'c+':
                    $context = stream_context_create(['sftp' => ['session' => $this->getConnection()]]);
                    $handle = fopen($this->constructUrl($path), $mode, false, $context);
                    return RetryWrapper::wrap($handle);
            }

And see if that makes a different.

If that does fix the issue (and the error is thus with the sftpread/sftpwrite streams) can you try applying the following debug patch and see if that generates any relevant log messages

https://github.com/nextcloud/server/commit/9311d701c55cbca621e7adabfd778d067e06b50d

@icewind1991 That does fix the issue.

I will try the patch now.

@icewind1991 Attached errors.

It's weird because preview images generate fine. It's specifically when trying to download the file this happens.

new-errors.txt

And see if that makes a different.

This works ..

If that does fix the issue (and the error is thus with the sftpread/sftpwrite streams) can you try applying the following debug patch and see if that generates any relevant log messages

With both patches, I just get this:

[no app in context] Info: Deprecated event type for {"[object] (OCP\SabrePluginEvent)":{"*statusCode":200,"*message":"","*server":{"[object] (OCA\DAV\Connector\Sabre\Server)":{"tree":"[object] (OCA\DAV\Connector\Sabre\ObjectTree)","*baseUri":"/remote.php/webdav/","httpResponse":"[object] (Sabre\HTTP\Response)","httpRequest":"[object] (Sabre\HTTP\Request)","sapi":"[object] (Sabre\HTTP\Sapi)","*plugins":[],"transactionType":null,"protectedProperties":{"...":"Over 20 items, aborting normalization"},"debugExceptions":false,"resourceTypeMapping":[],"enablePropfindDepthInfinity":true,"xml":"[object] (Sabre\DAV\Xml\Service)","*listeners":{"...":"Over 20 items, aborting normalization"},"*wildcardListeners":[],"*listenerIndex":[],"*logger":null}},"Symfony\Contracts\EventDispatcher\EventpropagationStopped":false}}: null

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=5s6b5v7bvzn
from 192.168.1.163 by matias at 2020-05-15T13:57:21+00:00

In raw:

{"reqId":"Xr6fwUe-p3vM@-AksYtJbgAAABM","level":1,"time":"2020-05-15T13:57:21+00:00","remoteAddr":"192.168.1.163","user":"matias","app":"no app in context","method":"GET","url":"/remote.php/w
ebdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=5s6b5v7bvzn","message":"Deprecated event type for {\"[object] (OCP\\SabrePluginEvent)\":{\"*statusCode\":200,\"*message\":\"\",\"*
server\":{\"[object] (OCA\\DAV\\Connector\\Sabre\\Server)\":{\"tree\":\"[object] (OCA\\DAV\\Connector\\Sabre\\ObjectTree)\",\"*baseUri\":\"/remote.php/webdav/\",\"httpResponse\":\"[object] (
Sabre\\HTTP\\Response)\",\"httpRequest\":\"[object] (Sabre\\HTTP\\Request)\",\"sapi\":\"[object] (Sabre\\HTTP\\Sapi)\",\"*plugins\":[],\"transactionType\":null,\"protectedProperties\":{\"...
\":\"Over 20 items, aborting normalization\"},\"debugExceptions\":false,\"resourceTypeMapping\":[],\"enablePropfindDepthInfinity\":true,\"xml\":\"[object] (Sabre\\DAV\\Xml\\Service)\",\"*lis
teners\":{\"...\":\"Over 20 items, aborting normalization\"},\"*wildcardListeners\":[],\"*listenerIndex\":[],\"*logger\":null}},\"Symfony\\Contracts\\EventDispatcher\\EventpropagationStopped
\":false}}: null","userAgent":"Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0","version":"19.0.0.10"}

It's weird because preview images generate fine. It's specifically when trying to download the file this happens.

I am not sure if new previews are created.. In my case its are already in cache .. But I cannot upload new files either .. :wink:

Just with second path:

[no app in context] Info: Deprecated event type for {"[object] (OCP\SabrePluginEvent)":{"*statusCode":200,"*message":"","*server":{"[object] (OCA\DAV\Connector\Sabre\Server)":{"tree":"[object] (OCA\DAV\Connector\Sabre\ObjectTree)","*baseUri":"/remote.php/webdav/","httpResponse":"[object] (Sabre\HTTP\Response)","httpRequest":"[object] (Sabre\HTTP\Request)","sapi":"[object] (Sabre\HTTP\Sapi)","*plugins":[],"transactionType":null,"protectedProperties":{"...":"Over 20 items, aborting normalization"},"debugExceptions":false,"resourceTypeMapping":[],"enablePropfindDepthInfinity":true,"xml":"[object] (Sabre\DAV\Xml\Service)","*listeners":{"...":"Over 20 items, aborting normalization"},"*wildcardListeners":[],"*listenerIndex":[],"*logger":null}},"Symfony\Contracts\EventDispatcher\EventpropagationStopped":false}}: null

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:58+00:00
[sftp] Error: Unexpected response from open command 'NET_SFTP_STATUS_NO_SUCH_FILE: No such file'

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:59+00:00
[PHP] Error: fopen(sftpread://home/matias/Imágenes/The Big Bang Theory//111951_0234b.jpg): failed to open stream: &quot;OCA\Files_External\Lib\Storage\SFTPReadStream::stream_open&quot; call failed at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SFTP.php#378

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:59+00:00
[webdav] Fatal: Sabre\DAV\Exception\ServiceUnavailable: Could not open file at <<closure>>

0. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 90
   OCA\DAV\Connector\Sabre\File->get()
1. /var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
   Sabre\DAV\CorePlugin->httpGet(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
2. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 474
   Sabre\DAV\Server->emit("method:GET", [Sabre\HTTP\Requ ... }])
3. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 251
   Sabre\DAV\Server->invokeMethod(Sabre\HTTP\Request {}, Sabre\HTTP\Response {})
4. /var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 319
   Sabre\DAV\Server->start()
5. /var/www/html/nextcloud/apps/dav/appinfo/v1/webdav.php line 82
   Sabre\DAV\Server->exec()
6. /var/www/html/nextcloud/remote.php line 167
   require_once("/var/www/html/n ... p")

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:59+00:00
[PHP] Error: Undefined index: debugMode at /var/www/html/nextcloud/core/templates/exception.php#17

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:59+00:00
[PHP] Error: Undefined index: debugMode at /var/www/html/nextcloud/core/templates/exception.php#26

GET /remote.php/webdav/SFTP/111951_0234b.jpg?downloadStartSecret=an0yw10dws
from 192.168.1.163 by matias at 2020-05-15T14:13:59+00:00

I am not sure if new previews are created.. In my case its are already in cache .. But I cannot upload new files either .. 😉

You're right, that does appear to be the case.

Thanks for the info, I'll probably come up with some more debug patches after the weekend

@icewind1991 Not to go off topic here but while we're discussing SFTP back on v18 it took a while to load into folders. I couldn't replicate the delay with SFTP mounted in dolphin on KDE. How much does latency affect SFTP in nextcloud?

I will happily open another bug report once you've fixed SFTP in NC 19 if I can still replicate the behavior.

There is probably a problem with mapping the nextcloud paths into sftp paths, can you try the following debug steps.

  • Apply 809d5bdc50 and try to open a file, it should log the sftp path it's trying to open
  • Disable the new sftp optimizations as described in https://github.com/nextcloud/server/issues/20979#issuecomment-629213272
  • In 3rdparty/phpseclib/phpseclib/phpseclib/Net/SFTP/Stream.php line 292 add \OC::$server->getLogger()->warning("[upstream] Opened sftp path: $path"); (before the return true in _stream_open
  • Try opening the file again, again an sftp path should be logged.

And reply which paths are logged by both methods

Patch1 for 809d5bd
patch1.txt

Patch2 for the rest.
patch2.txt

Thanks,

can you try applying 85cd63de2c and see if it makes a difference (you'll have to undo the "disable optimizations" again step of course)

Thank @icewind1991

Apply a mix of both patches..

[, $path] = explode('://', $path);
$logger->warning("Opened sftp path without ltrim: $path");

$path = '/' . ltrim($path);
$path = str_replace('//', '/', $path);
$logger->warning("Opened sftp path with ltrim: $path");

Work fine and see that:

[no app in context] Warning: Opened sftp path without ltrim: home/matias/Imágenes/The Big Bang Theory//el-final-de-the-big-bang-theory-gratis-en-el-monumento-a-la-revolucion.jpg

GET /remote.php/webdav/SFTP/el-final-de-the-big-bang-theory-gratis-en-el-monumento-a-la-revolucion.jpg?downloadStartSecret=grrxp6xcdet
from 192.168.1.163 by matias at 2020-05-20T13:51:29+00:00

And...

[no app in context] Warning: Opened sftp path with ltrim: /home/matias/Imágenes/The Big Bang Theory/el-final-de-the-big-bang-theory-gratis-en-el-monumento-a-la-revolucion.jpg

GET /remote.php/webdav/SFTP/el-final-de-the-big-bang-theory-gratis-en-el-monumento-a-la-revolucion.jpg?downloadStartSecret=grrxp6xcdet
from 192.168.1.163 by matias at 2020-05-20T13:51:29+00:00

Is there a change in behaviour (or further error messages) when applying the "trim patch", and does new "trimmed" version of the path match the one from the "upstream patch" (see https://github.com/nextcloud/server/issues/20979#issuecomment-630956821)

Is there a change in behaviour (or further error messages) when applying the "trim patch"

With the last patch it works the same as in NC18, and just like with optimization disabled, I don't see any change in behavior..

and does new "trimmed" version of the path match the one from the "upstream patch" (see #20979 (comment))

With last trimmed patch: https://github.com/nextcloud/server/commit/85cd63de2c9b741c5f093095d3b98eaba7f4c590

[no app in context] Warning: Opened sftp path: /home/matias/Imágenes/The Big Bang Theory/5cdede8493a1523698058b33.jpg

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=rj6pxgrbrpn
from 192.168.1.163 by matias at 2020-05-22T13:01:28+00:00

With original patch that disable optimizations: https://github.com/nextcloud/server/issues/20979#issuecomment-630956821

[no app in context] Warning: [upstream] Opened sftp path: /home/matias/Imágenes/The Big Bang Theory/5cdede8493a1523698058b33.jpg

GET /remote.php/webdav/SFTP/5cdede8493a1523698058b33.jpg?downloadStartSecret=mziclxrkrd
from 192.168.1.163 by matias at 2020-05-22T13:05:30+00:00

These are the same..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rullzer picture rullzer  Â·  3Comments

MorrisJobke picture MorrisJobke  Â·  3Comments

brylie picture brylie  Â·  3Comments

ChristophWurst picture ChristophWurst  Â·  3Comments

georgehrke picture georgehrke  Â·  3Comments