ownpad icon indicating copy to clipboard operation
ownpad copied to clipboard

OwnPad does not allow sharing folders of Etherpads

Open ichdasich opened this issue 2 years ago • 7 comments

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:

  • Create a folder in nextcloud
  • Create a pad in the folder
  • Share the folder (share via link)
  • Open the link in a new window or anonymous browser window
  • Observe the above error

ichdasich avatar Oct 13 '23 10:10 ichdasich

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

otetard avatar Oct 13 '23 12:10 otetard

Yes, can confirm that.

ichdasich avatar Oct 13 '23 13:10 ichdasich

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 avatar Oct 13 '23 13:10 ichdasich

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

ichdasich avatar Oct 13 '23 20:10 ichdasich

I got this problem too.

ownpad 0.10.0 & nextcloud 28.0.2

internethering avatar Feb 05 '24 13:02 internethering

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 avatar Apr 18 '24 17:04 quenenni

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.

quenenni avatar Apr 18 '24 17:04 quenenni