Missing debug information in File.php while using Music

Hi,
While scanning the music of one of my users XX who get his music from a share from a second account YY I got a cryptic error.

sudo -u www-data php ./occ music:scan --debug --debug --debug XX

Error :

In File.php line 112:
[OCP\Files\NotPermittedException]

It is very cryptic and does not provide any info to be able to debug.

For the error message the issue seems to be in ./lib/private/Files/Node/File.php

           if ($this->checkPermissions($requiredPermissions)) {
                    $this->sendHooks($preHooks);
                    $result = $this->view->fopen($this->path, $mode);
                    $this->sendHooks($postHooks);
                    return $result;
            } else {
                    throw new NotPermittedException();
            }
    }

I suggest to have the following upgrade :slight_smile:

           if ($this->checkPermissions($requiredPermissions)) {
                    $this->sendHooks($preHooks);
                    $result = $this->view->fopen($this->path, $mode);
                    $this->sendHooks($postHooks);
                    return $result;
            } else {
                    throw new NotPermittedException('Could not open (Incorrect mode ' . $mode . ') ' . $this->path);
            }
    }

Posting code changes in the help forum isn’t the right way to go. You should better directly create a pull request in the server repository :wink:

Hi,
I will try but I consider beeing a newcommer to php, and may be my proposal is out of scope or wrong.

By the way my config :slight_smile:

Server configuration detail

Operating system: Linux 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64

Webserver: Apache (apache2handler)

Database: mysql 10.3.22

PHP version: 7.3.11-1~deb10u1

Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, sodium, standard, apache2handler, mysqlnd, PDO, xml, apcu, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, intl, json, exif, msgpack, mysqli, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, memcached, Zend OPcache

Nextcloud version: 17.0.3 - 17.0.3.1

Updated from an older Nextcloud/ownCloud or fresh install:

I’ll try a pull request. Hope not to bother…

I think the developers will always be happy to support you on this :wink:

I tried to follow the process to contribute and I thought that I did made an error.

The consequence is that I have pushed two pullrequest with the same content …

#19558 and #19557

and also I deleted my first pulrequest repository.

Do you know where I can get help to fix those errors without making them worse…

Regards.