otetard / ownpad

Ownpad is a Nextcloud application that allows to create and open Etherpad and Ethercalc documents.
GNU Affero General Public License v3.0
58 stars 25 forks source link

OwnPad does not allow sharing folders of Etherpads #134

Open ichdasich opened 1 year ago

ichdasich commented 1 year ago

When sharing a folder (publicly) that has multiple etherpad links in it, nextcloud (27.1.2) with ownpad (0.9.5) does not support this. The error log shows:

When accessing the shared folder anonymously:

Exception: Call to a member function file_get_contents() on null in file '/var/www/nextcloud/lib/private/Files/Filesystem.php' line 560

When accessing the shared folder while having a user session but via the public share link:

file_get_contents(/var/www/nextcloud/data/testuser/files/test.pad): Failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#305
Undefined array key 1 at /var/www/nextcloud/apps/ownpad/lib/Service/OwnpadService.php#132
Undefined array key 1 at /var/www/nextcloud/apps/ownpad/lib/Service/OwnpadService.php#132

Sharing and opening individual pads works.

I suspect that the implementation for public shares uses a different way of accessing files, and only the internal version has been appropriately hooked/loads the right MIME options.

To reproduce:

otetard commented 1 year ago

Thanks for the feedback. Can you confirm that sharing a single Etherpad document publicly works as expected please?

ichdasich commented 1 year ago

Yes, can confirm that.

ichdasich commented 1 year ago

Btw, the current workaround i suggested $users is using the link_editor app to add direct links to the concerned etherpads into the to-be-shared folder, while storing the actual pads elsewhere (level above, e.g.).

Kind of gives the same UX (with some extra steps for the folder owner, but at least for those clicking on the folder);

ichdasich commented 1 year ago

Note: Just noticed that there is a typo in the nextcloud version; It is actually 27.1.2; Updated the first entry accordingly.

internethering commented 9 months ago

I got this problem too.

ownpad 0.10.0 & nextcloud 28.0.2

quenenni commented 7 months ago

Hello,

I also have the problem (ownpad 0.9.5 / Nextcloud 26.0.4).

Sharing a folder with .pad files and someone trying to access one of these files receives the error: URL in your Etherpad/Ethercalc document does not match the allowed server

In Nextcloud.log, I see the message:

"message":"file_get_contents(/mnt/nextcloud/YYYY/data/XXXX/files/00 Calendrier descours.pad): Failed to open stream: No such file or directory at /home/nextcloud/instances/YYYY/lib/private/Files/Storage/Local.php#305",

I noticed the problem comes from the file ./lib/Service/OwnpadService.php.

The var $content passed as a parameter to the function parseOwnpadContent is empty. So the 2 lines to get the Url from the content return an empty string:

        preg_match('/URL=(.*)$/', $content, $matches);
        $url = $matches[1];

And then, later on, when testing the Url with a regexp, it returns false and throws the error:

        if (preg_match($regex, $url) !== 1) {
            throw new OwnpadException($l10n->t('URL in your Etherpad/Ethercalc document does not match the allowed server'));
        }

If I manually set the $url var to an url found in a .pad file, I can open and edit it.

But I couldn't find why this $content param is empty.

quenenni commented 7 months ago

One thing I noticed that could help understand why we have this (or not):

The $file param from the function has the correct filename, but not the correct path.

Maybe it's normal, but as the pad file is at the root of the public share, the $file var has the value: file: /00 Calendrier descours.pad (and the file is not at the root of anything, it is in a subdirectory of anuser account)

Maybe it can't find the file because it looks at the wrong place for the file.

AS the nextcloud.log shows, it looks for the file here: file_get_contents(/mnt/nextcloud/YYYY/data/XXXX/files/00 Calendrier descours.pad)

And that's not the right folder for this file.