Direct link to PDF file in shared folder

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version: 25.0.2
Operating system and version : Ubuntu 22.04.1 LTS
Apache or nginx version: 2.4.52
PHP version: 8.1

The issue you are facing:
I am sharing folder with lots of PDF files. When I click to a single file, it is displayed. I would like to send somebody direct link to the PDF file. So I copy URL (like: https://my.instance.com/index.php/s/public?dir=undefined&path=xxx&openfile=6743). But when I copy this URL to another browser tab it is not working. It only displays whole directory.

Is it possible to directly link files without sharing every single file?
Thank you.

Is this the first time you’ve seen this error? : N

Steps to replicate it:

  1. Share folder with PDF files.
  2. Open some PDF.
  3. Copy URL from browser
  4. Try it in another tab.

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

$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxx,
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'xxx',
    1 => 'xxx'
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '25.0.2.3',
  'overwrite.cli.url' => 'https://xxx',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'mail_from_address' => 'xxx-noreply',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'xxx',
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '25',
  'default_phone_region' => 'CZ',
'memcache.local' => '\OC\Memcache\APCu',
);

If you share the parent folder, sure.

There are really two types of URLs mainly used. A share URL links to a shared file or folder. Obviously that would involve at least sharing the folder. Not necessarily every individual file.

The other URL is the internal URL. No sharing required, but the user must be signed in and have access to the file.

For security reasons, there aren’t publicly accessible links to files by default.

Thank you for your answer. So what am I doing wrong? Lets see my ugly censored gif “video”.
Select file, open it.
Copy url to another tab.
File is not open, only its parent folder.
Is this normal behavior or bug?
Thank you.
ezgif.com-gif-maker