Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with file_get_contents() at OC\\Files\\Filesystem #28370

Closed
solracsf opened this issue Aug 10, 2021 · 2 comments · Fixed by #28473
Closed

Problem with file_get_contents() at OC\\Files\\Filesystem #28370

solracsf opened this issue Aug 10, 2021 · 2 comments · Fixed by #28473
Labels
2. developing Work in progress bug

Comments

@solracsf
Copy link
Member

  • NC 20.0.12
  • datadirectory = /files

Path is somehow truncated as /files/data/user/files/_trashbin/ instead of /files/data/user/files/files_trashbin/

Error log

{
  "reqId": "91fcqmBt7KNIncDVGS4v",
  "level": 3,
  "time": "2021-08-10T15:16:41+00:00",
  "app": "PHP",
  "method": "GET",
  "url": "/apps/files_trashbin/preview?fileId=13990321&file=Nextcloud.png%2FNextcloud.png.d1628608598&c=1628608598",
  "message": {
    "Exception": "Error",
    "Message": "file_get_contents(/files/data/user/files/_trashbin/files/Nextcloud.png.d1628608598): failed to open stream: No such file or directory at /lib/private/Files/Storage/Local.php#278",
    "Code": 0,
    "Trace": [
      {
        "function": "onError",
        "class": "OC\\Log\\ErrorHandler",
        "type": "::",
        "args": [
          2,
          "file_get_contents(/files/data/user/files/_trashbin/files/Nextcloud.png.d1628608598): failed to open stream: No such file or directory",
          "/lib/private/Files/Storage/Local.php",
          278,
          {
            "path": "files/_trashbin/files/Nextcloud.png.d1628608598"
          }
        ]
      },
      {
        "file": "/lib/private/Files/Storage/Local.php",
        "line": 278,
        "function": "file_get_contents",
        "args": [
          "/files/data/user/files/_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Files/Storage/Wrapper/Wrapper.php",
        "line": 246,
        "function": "file_get_contents",
        "class": "OC\\Files\\Storage\\Local",
        "type": "->",
        "args": [
          "files/_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Files/Storage/Wrapper/Wrapper.php",
        "line": 246,
        "function": "file_get_contents",
        "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
        "type": "->",
        "args": [
          "files/_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Files/View.php",
        "line": 1167,
        "function": "file_get_contents",
        "class": "OC\\Files\\Storage\\Wrapper\\Wrapper",
        "type": "->",
        "args": [
          "files/_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Files/View.php",
        "line": 597,
        "function": "basicOperation",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "file_get_contents",
          "/_trashbin/files/Nextcloud.png.d1628608598",
          [
            "read"
          ]
        ]
      },
      {
        "file": "/lib/private/Files/Filesystem.php",
        "line": 716,
        "function": "file_get_contents",
        "class": "OC\\Files\\View",
        "type": "->",
        "args": [
          "_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/legacy/OC_Image.php",
        "line": 624,
        "function": "file_get_contents",
        "class": "OC\\Files\\Filesystem",
        "type": "::",
        "args": [
          "_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Preview/Image.php",
        "line": 52,
        "function": "loadFromFile",
        "class": "OC_Image",
        "type": "->",
        "args": [
          "/files/data/user/files_trashbin/files/Nextcloud.png.d1628608598"
        ]
      },
      {
        "file": "/lib/private/Preview/GeneratorHelper.php",
        "line": 63,
        "function": "getThumbnail",
        "class": "OC\\Preview\\Image",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          4096,
          4096
        ]
      },
      {
        "file": "/lib/private/Preview/Generator.php",
        "line": 244,
        "function": "getThumbnail",
        "class": "OC\\Preview\\GeneratorHelper",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Preview\\PNG"
          },
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          4096,
          4096
        ]
      },
      {
        "file": "/lib/private/Preview/Generator.php",
        "line": 140,
        "function": "getMaxPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\SimpleFS\\SimpleFolder"
          },
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          "image/png",
          ""
        ]
      },
      {
        "file": "/lib/private/Preview/Generator.php",
        "line": 109,
        "function": "generatePreviews",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          [
            {
              "width": 128,
              "height": 128,
              "crop": true,
              "mode": "fill"
            }
          ],
          "image/png"
        ]
      },
      {
        "file": "/lib/private/PreviewManager.php",
        "line": 190,
        "function": "getPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          128,
          128,
          true,
          "fill",
          "image/png"
        ]
      },
      {
        "file": "/apps/files_trashbin/lib/Controller/PreviewController.php",
        "line": 122,
        "function": "getPreview",
        "class": "OC\\PreviewManager",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Files\\Node\\File"
          },
          128,
          128,
          true,
          "fill",
          "image/png"
        ]
      },
      {
        "file": "/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 169,
        "function": "getPreview",
        "class": "OCA\\Files_Trashbin\\Controller\\PreviewController",
        "type": "->",
        "args": [
          13990321,
          128,
          128
        ]
      },
      {
        "file": "/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 100,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Trashbin\\Controller\\PreviewController"
          },
          "getPreview"
        ]
      },
      {
        "file": "/lib/private/AppFramework/App.php",
        "line": 152,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Trashbin\\Controller\\PreviewController"
          },
          "getPreview"
        ]
      },
      {
        "file": "/lib/private/Route/Router.php",
        "line": 309,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Trashbin\\Controller\\PreviewController",
          "getPreview",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "files_trashbin.Preview.getPreview"
          }
        ]
      },
      {
        "file": "/lib/base.php",
        "line": 1008,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/files_trashbin/preview"
        ]
      },
      {
        "file": "/index.php",
        "line": 37,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/lib/private/Log/ErrorHandler.php",
    "Line": 91,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
  "version": "20.0.11.1",
  "id": "6112989a12e26"
}
@solracsf solracsf added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 10, 2021
@solracsf
Copy link
Member Author

Similar to #27441

solracsf added a commit that referenced this issue Aug 17, 2021
Try to fix #28370  and #27441 

Avoid pre-pends the `$path` to the user's own storage.
@szaimen szaimen added 2. developing Work in progress and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 17, 2021
backportbot-nextcloud bot pushed a commit that referenced this issue Oct 4, 2021
Try to fix #28370  and #27441 

Avoid pre-pends the `$path` to the user's own storage.
@szaimen szaimen reopened this Oct 3, 2022
@szaimen szaimen closed this as completed Oct 3, 2022
@AndyXheli
Copy link

Hey all getting bellow error on NC 25 RC3 is this similar to this ?

{"reqId":"seZk4QM7k53twRgTlOxg","level":3,"time":"2022-10-11T13:51:16+00:00","remoteAddr":"10.0.10.90","user":"axheli","app":"PHP","method":"GET","url":"/apps/theming/img/core/filetypes/text.svg?v=6986","message":"file_get_contents(/var/data/appdata_ocxs1gtpahaq/theming/6994/icon-core-filetypes_text.svg): Failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#303","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36","version":"25.0.0.15","exception":{"Exception":"Error","Message":"file_get_contents(/var/data/appdata_ocxs1gtpahaq/theming/6994/icon-core-filetypes_text.svg): Failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#303","Code":0,"Trace":[{"function":"onError","class":"OC\Log\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Local.php","line":303,"function":"file_get_contents"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1181,"function":"file_get_contents","class":"OC\Files\Storage\Local","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":600,"function":"basicOperation","class":"OC\Files\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Node/File.php","line":56,"function":"file_get_contents","class":"OC\Files\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php","line":97,"function":"getContent","class":"OC\Files\Node\File","type":"->"},{"file":"/var/www/nextcloud/lib/public/AppFramework/Http/FileDisplayResponse.php","line":68,"function":"getContent","class":"OC\Files\SimpleFS\NewSimpleFile","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":229,"function":"callback","class":"OCP\AppFramework\Http\FileDisplayResponse","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"63457861f1d48"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants