Unable to open user's PDF file in a shared folder

PDF viewer works: on the standard Nextcloud user manual pdf. I can view it:
https://myproject.mysite.com/index.php/apps/files/?dir=/&openfile=24

However it doesn’t work here:

A user in our project uploaded a PDF file to a shared folder. Now no one can view it.
It is visible in the folder and can be seen by the original user and the shared folder group members.
However anytime the file is clicked on the following error occurs:

Error:PDF.js v2.4.456 (build: 228a591c)
Message: Missing PDF "https://myproject.mysite.com/remote.php/dav/files/administrator/Projects/Projects%20in%20Progress/Aldi%20#161%20Windermere/Owner%20Contract/Aldi%20#161%20Windermere%20agreement%20(signed)%2011-3-20.pdf".

What do I need to do to make the file viewable so when one clicks, the file can be seen?
Is there a configuration setting somewhere that I can set to make it work correctly?

This is the URL from the nextcloud folder view
pdf file: https://myproject.mysite.com/index.php/apps/files/?dir=/Projects/Projects%20in%20Progress/Aldi%20%23161%20Windermere/Owner%20Contract&fileid=1383

After I clicked and nextcloud took me here
https://myproject.mysite.com/index.php/apps/files/?dir=/Projects/Projects%20in%20Progress/Aldi%20%23161%20Windermere/Owner%20Contract&openfile=1385

physical location on website:
https://myproject.mysite.com/data/administrator/files/Projects/Projects%20in%20Progress/Aldi%20%23161%20Windermere/Owner%20Contract/Aldi%20%23161%20Windermere%20agreement%20(signed)%2011-3-20.pdf

Is this the first time you’ve seen this error? YES, this is a new install of the software

Steps to replicate it:

  1. Click on shared folder and navigate to the pdf file

  2. Click on PDF file

  3. PDF file is not shown but an error message is available by clicking on it.

    Database: mysql 5.7.31-percona-sure1-log
    PHP Version: 7.4 (FPM with OPcache)
    Nextcloud version: 20.0.1
    Apache 2.4.46
    PDF Viewer: PDF.js v2.4.456 (build: 228a591c)

LOGFILE: Event:

{“reqId”:“X8voEpK2cHja30YE53MzfAAAmjE”,“level”:3,“time”:“2020-12-05T20:05:38+00:00”,“remoteAddr”:“198.104.97.2”,“user”:“administrator”,“app”:“PHP”,“method”:“GET”,“url”:"/index.php/apps/files/ajax/getstoragestats.php?dir=%2FProjects%2FProjects%20in%20Progress%2FAldi%20%23161%20Windermere%2FOwner%20Contract",“message”:{“Exception”:“Error”,“Message”:“Undefined offset: 3 at /home/mysite/www/projects/lib/private/legacy/OC_Helper.php#548”,“Code”:0,“Trace”:[{“file”:"/home/mysite/www/projects/lib/private/legacy/OC_Helper.php",“line”:548,“function”:“onError”,“class”:“OC\Log\ErrorHandler”,“type”:"::",“args”:[8,“Undefined offset: 3”,"/home/mysite/www/projects/lib/private/legacy/OC_Helper.php",548,{“path”:"/Projects/Projects in Progress/Aldi #161 Windermere/Owner Contract",“rootInfo”:{“class”:“OC\Files\FileInfo”},“includeExtStorage”:false,“used”:2177783,“quota”:1073741824,“mount”:{“class”:“OC\Files\Mount\MountPoint”},“storage”:{“mountPoint”:"/administrator/",“cache”:null,“scanner”:{“class”:“OC\Files\Cache\Scanner”},“watcher”:null,“propagator”:null,“updater”:null,“class”:“OCA\TermsOfService\Filesystem\StorageWrapper”},“sourceStorage”:{“mountPoint”:"/administrator/",“cache”:null,“scanner”:{“class”:“OC\Files\Cache\Scanner”},“watcher”:null,“propagator”:null,“updater”:null,“class”:“OCA\TermsOfService\Filesystem\StorageWrapper”},“free”:1040306354,“total”:1042484137,“relative”:0.21,“ownerId”:“administrator”,“ownerDisplayName”:“administrator”,“owner”:{“class”:“OC\User\User”}}]},{“file”:"/home/mysite/www/projects/apps/files/lib/Helper.php",“line”:51,“function”:“getStorageInfo”,“class”:“OC_Helper”,“type”:"::",“args”:["/Projects/Projects in Progress/Aldi #161 Windermere/Owner Contract"]},{“file”:"/home/mysite/www/projects/apps/files/lib/Controller/AjaxController.php",“line”:47,“function”:“buildFileStorageStatistics”,“class”:“OCA\Files\Helper”,“type”:"::",“args”:["/Projects/Projects in Progress/Aldi #161 Windermere/Owner Contract"]},{“file”:"/home/mysite/www/projects/lib/private/AppFramework/Http/Dispatcher.php",“line”:169,“function”:“getStorageStats”,“class”:“OCA\Files\Controller\AjaxController”,“type”:"->",“args”:["/Projects/Projects in Progress/Aldi #161 Windermere/Owner Contract"]},{“file”:"/home/mysite/www/projects/lib/private/AppFramework/Http/Dispatcher.php",“line”:100,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Files\Controller\AjaxController”},“getStorageStats”]},{“file”:"/home/mysite/www/projects/lib/private/AppFramework/App.php",“line”:152,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OCA\Files\Controller\AjaxController”},“getStorageStats”]},{“file”:"/home/mysite/www/projects/lib/private/Route/Router.php",“line”:308,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::",“args”:[“OCA\Files\Controller\AjaxController”,“getStorageStats”,{“class”:“OC\AppFramework\DependencyInjection\DIContainer”},{“action”:null,"_route":“files.ajax.getStorageStats”}]},{“file”:"/home/mysite/www/projects/lib/base.php",“line”:1009,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->",“args”:["/apps/files/ajax/getstoragestats.php"]},{“file”:"/home/mysite/www/projects/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:[]}],“File”:"/home/mysite/www/projects/lib/private/Log/ErrorHandler.php",“Line”:91,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0”,“version”:“20.0.1.1”,“id”:“5fcbe822eda54”}


The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'sailing',
  'passwordsalt' => 'this',
  'secret' => 'isnottoodifficulttobreak',
  'trusted_domains' => 
  array (
    0 => 'myproject.mysite.com',
  ),
  'datadirectory' => '/home/mysite/www/projects/data',
  'dbtype' => 'mysql',
  'version' => '20.0.1.1',
  'overwrite.cli.url' => 'http://myproject.mysite.com',
  'dbname' => 'my_projects',
  'dbhost' => '127.0.0.1',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'AfterTheBreak',
  'dbpassword' => 'Twoor3FishPlayHere',
  'installed' => true,
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'administrator',
  'mail_domain' => 'mysite.com',
  'tempdirectory' => '/home/mysite/www/projects/data/tempo',
  'app_install_overwrite' => 
  array (
    0 => 'quest',
  ),
  'theme' => '',
  'updater.release.channel' => 'stable',
);

Please repeat all with “test.php”.
Rename or copy the original.

1 Like

This was a good idea. I copied it to test.pdf and then proceeded to copy the file down the tree until it no longer displayed. There is a folder with a # in it. The name of the original file had a # in it as well.

I renamed the folder and removed the # (# represented store number). and test.pdf displayed correctly. I also removed the # from the original fiile.

1 Like

It appears a file with a # or a directory with a # in the name causes it to not be found.

1 Like

The problem exists not only with # in file- or directorynames: