Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resharing-Link broken #12802

Closed
wm-simon opened this issue Dec 11, 2014 · 16 comments
Closed

Resharing-Link broken #12802

wm-simon opened this issue Dec 11, 2014 · 16 comments

Comments

@wm-simon
Copy link

I have an folder shared for other users. If i log in with one of the other accounts, add and share a folder inside the shared folder as link, there comes just a message for a broken link.

@karlitschek
Copy link
Contributor

@schiesbn

@PVince81
Copy link
Contributor

@Pfeifakopf please use the issue template: https://raw.github.com/owncloud/core/master/issue_template.md

@Do-D
Copy link

Do-D commented Jan 2, 2015

Hi,
I have the same behaviour.
resharing public links is no longer possible, I can't tell when it stopped working...

Steps to reproduce

  1. Create a Folder and Share it to a group.
  2. Login with a User in this group, create a new file/folder in the shared folder and reshare with a public link

Expected behaviour

the reshared file should be shown

Actual behaviour

It appears a Owncloud Error for a broken link:

Sorry, this link doesn’t seem to work anymore.
Reasons might be:
    the item was removed
    the link expired
    sharing is disabled
For more info, please ask the person who sent this link.

Server configuration

Operating system:
Ubuntu 14.04
Web server:
NGINX 1.4.6
Database:
Mysql
PHP version:
PHP 5.5.x
ownCloud version: (see ownCloud admin page)
Owncloud 7.0.4
Updated from an older ownCloud or fresh install:
Update from 7.0.3
List of activated apps:
Activity, Deleted Files, PDF, Pictures, Share Files, Video Viewer
The content of config/config.php:

$CONFIG = array (
  'instanceid' => 'oc9e75b7d134',
  'passwordsalt' => 'xxx,
  'trusted_domains' =>
  array (
    0 => 'xxx',
    1 => 'xxx,
  ),
  'datadirectory' => '/mnt/oc-data',
  'dbtype' => 'mysql',
  'version' => '7.0.4.2',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => 'xxxx',
  'installed' => true,
  'forcessl' => true,
  'enable_previews' => true,
  'preview_max_x' => 1280,
  'preview_max_y' => 800,
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => 'owncloud',
  'mail_domain' => 'xxx',
  'mail_smtphost' => '10.33.1.3',
  'logfile' => '/var/log/owncloud/owncloud.log',
  'loglevel' => '0',
  'logtimezone' => 'Europe/Vienna',
  'log_type' => 'owncloud',
  'log_authfailip' => true,
  'check_for_working_htaccess' => false,
  'check_for_working_webdav' => false,
  'has_internet_connection' => false,
  'enable_avatars' => false,
  'appstoreenabled' => false,
  'updatechecker' => false,
  'theme' => '',
  'maintenance' => false,
  'singleuser' => false,
  'asset-pipeline.enabled' => true,
  'skeletondirectory' => '',
  'secret' => 'xxx',
);

Are you using external storage, if yes which one: local/smb/sftp/...
NO
Are you using encryption: yes/no
NO

Client configuration

Browser:
FF, IE
Operating system:

Logs

Web server error log

No Error log

ownCloud log (data/owncloud.log)

only if I choose DEBUG

Debug   share   could not resolve linkItem  2015-01-02T12:57:57+01:00 

Browser log

@Do-D
Copy link

Do-D commented Jan 5, 2015

I have to bring this up again.
I noticed that when I reshare a file and look at "Shared by Link" I see the shared file but the link is wrong.
For a normal "Shared by link" file the link looks like:

https://xx.xx/index.php/apps/files/ajax/download.php?dir=%2Ftest&files=Jellyfish.jpg

for a reshared file it looks like this

https://xx.xx.at/index.php/apps/files/ajax/download.php?dir=files%2Ftest%2Ftest&files=test.zip

after ?dir= there is added the string "files" if I copy the link and delete this string I get the correct download prompt.
Otherwise I only get to see the error "file not found" maybe a wrong link is also the problem for the public shared link?

Any help is appreciated!

@PVince81
Copy link
Contributor

PVince81 commented Jan 7, 2015

The link you posted is not a link share.
You should use the link that appears in the share dropdown under the "Share link" checkbox.
It contains "public.php" and a token argument.

Still, does it mean that regular file download doesn't work for you for reshared files ? (regardless of public link)

@Do-D
Copy link

Do-D commented Jan 7, 2015

Let me try to clear the question
1st Problem:
After Uploading a file test.zip in a shared folder /test I reshare the file and create a public link:

https://mydomain.at/public.php?service=files&t=5a1f2d0859c5c0eab05b95f2e7748194

This Link is broken and leads to a error website: Sorry, this link doesn’t seem to work anymore.

2nd Problem:
Every file shared by public link also shows up in the Section "Shared by Link" for the logged in User.
In this section the file is displayed but the link is also broken, it shows error page file not found

https://xx.xx.at/index.php/apps/files/ajax/download.php?dir=files%2Ftest&files=test.zip

In this example the folder test is a shared folder in which I uploaded the file test.zip.

But If I navigate manually (Section "All Files") in the shared folder test/ I can download the file test.zip and the link looks like this:

https://xx.xx.at/index.php/apps/files/ajax/download.php?dir=%2Ftest&files=test.zip

Both problems ONLY happen for reshared files, not for files stored in the users home directory!

@PVince81
Copy link
Contributor

PVince81 commented Jan 7, 2015

Okay I see. Is the domain name always the same for the shared files, including the public link ?

Can you check the database entry matching the share ?
You can find it with select * from oc_share where token='5a1f2d0859c5c0eab05b95f2e7748194' then post the result here.
Also take the share id and check select * from oc_filecache where fileid=1234 (where 1234 is the share id from the call above).

I suspect that the share entry does exist, else you wouldn't see it in the "Shared with link" section. But somehow reading it from the public page still fails.

@Do-D
Copy link

Do-D commented Jan 8, 2015

Yes the domain name is always the same and correct.
For the test, I created a new public link therefore it has a new token:
https://xx.xx.at/public.php?service=files&t=8fe100661df9d15aac13fe2f879ee037

mysql> select * from oc_share where token='8fe100661df9d15aac13fe2f879ee037';
+-----+------------+------------+-------------------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+---------- ------------------------+-----------+
| id  | share_type | share_with | uid_owner         | parent | item_type | item_source | item_target | file_source | file_target | permissions | stime      | accepted | expiration | token                             | mail_send |
+-----+------------+------------+-------------------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+---------- ------------------------+-----------+
| 197 |          3 | NULL       | Do-D              |   NULL | file      | 4037        | /4037       |        4037 | /test.zip   |           1 | 1420640116 |        0 | NULL       | 8fe100661 df9d15aac13fe2f879ee037 |         0 |
+-----+------------+------------+-------------------+--------+-----------+-------------+-------------+-------------+-------------+-------------+------------+----------+------------+---------- ------------------------+-----------+
1 row in set (0.00 sec)

With Share ID you mean the item source 4037 from above?

mysql> select * from oc_filecache where fileid=4037;
+--------+---------+-------------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+---------------+-------------+
| fileid | storage | path                          | path_hash                        | parent | name     | mimetype | mimepart | size | mtime      | storage_mtime | encrypted | unencrypted_size | etag          | permissions |
+--------+---------+-------------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+---------------+-------------+
|   4037 |      23 | files/TEST/test.zip           | a2f55613d9429aa396ed17e17344ab63 |   4036 | test.zip |       20 |        3 | 5935 | 1420640070 |    1420640070 |         0 |                0 | 54ad3f4613f4f |          31 |
+--------+---------+-------------------------------+----------------------------------+--------+----------+----------+----------+------+------------+---------------+-----------+------------------+---------------+-------------+
1 row in set (0.00 sec)

I noticed that I can solve my problem by simply unsharing a folder (for every group) and then share the folder to all groups again. After that I can reshare files again?
So unless you have any other idea what is wrong I think I login with my "Share Users" and do this for all my groupshares?

@PVince81
Copy link
Contributor

PVince81 commented Jan 8, 2015

@schiesbn any clues ? Does that sound like of the known issues ?

@simne7
Copy link

simne7 commented Jan 9, 2015

I noticed the same issue after updating from 7.0.2. to 7.0.4 (via Updater). But I don't know if it results form the update.

working link from files app
https://xx.xx.de/index.php/apps/files/ajax/download.php?dir=%2Fpath%2Fto%2Ffolder&files=file.zip

link from "shared by link" (broken)
https://xx.xx.de/index.php/apps/files/ajax/download.php?dir=files%2Fpath%2Fto%2Ffolder&files=file.zip

As you notice the second link contains dir=files%2F as the only difference to the working link. May this be the reason for the broken sharing link (the one with the token, e.g. https://xx.xx.de/public.php?service=files&t=a45c399002as4df60560bd786f4ed4f1)?

@combatwombat
Copy link

Same problem here. It seems after the update to 7.0.4 only the owner of a shared folder can create a public link that works. Public links of members of the group the folder is shared to get a 404.

A guess:
I looked at the oc_share table and as in Do-Ds example above, the parent column is NULL, whereas with previous entries it contained the id for a shared parent folder (I think). And since OCP\Share::resolveReShare requires a parent, it's not working.

/public.php includes /apps/files_sharing/public.php. An excerpt with comments:

    if (isset($_GET['t'])) {
            $token = $_GET['t'];
            $linkItem = OCP\Share::getShareByToken($token, false);
            if (is_array($linkItem) && isset($linkItem['uid_owner'])) {

    //// $linkItems is set and contains the creator of the public share as uid_owner. So far so good.

                    // seems to be a valid share
                    $type = $linkItem['item_type'];
                    $fileSource = $linkItem['file_source'];
                    $shareOwner = $linkItem['uid_owner'];
                    $path = null;
                    $rootLinkItem = OCP\Share::resolveReShare($linkItem);

    //// resolveReShare() seems to walk up the tree along the parents until it finds the owner of the shared folder. But $rootLinkItem's uid_owner is still the same as in $linkItem, because parent is NULL.

                    if (isset($rootLinkItem['uid_owner'])) {
                            OCP\JSON::checkUserExists($rootLinkItem['uid_owner']);
                            OC_Util::tearDownFS();
                            OC_Util::setupFS($rootLinkItem['uid_owner']);
                            $path = \OC\Files\Filesystem::getPath($linkItem['file_source']);

    //// getPath() now returns the right path for me (owner of shared folder) but nothing for the other person, since maybe OC_Util::setupFS sets up the filesystem differently for the two users.
                    }
            }
    }

If this goes in the right direction, the question is, why is the parent in oc_share suddenly null. I'll try unsharing and resharing the folders after a backup.

@PVince81
Copy link
Contributor

Very likely to be a duplicate of #13361

Can you guys try with the following patch: #13470
You'll need to delete then re-create the public reshare.

After the fix the "parent" field should not be null any more.

@simne7
Copy link

simne7 commented Jan 28, 2015

👍
Overwriting /lib/private/share/share.php with the version from #13470 solved the issue for me. After de-selecting "Share link" and selecting it again everything worked. Thx!

@PVince81
Copy link
Contributor

Thanks a lot @simne7

@Pfeifakopf @Do-D @combatwombat how about you guys ?

@Do-D
Copy link

Do-D commented Jan 28, 2015

Hi,
deleting and re-creating the share did work for me too.
Thanks!

@PVince81
Copy link
Contributor

Thanks. I'm going to close this ticket then.

@Pfeifakopf @combatwombat if after applying the patch and recreating the share you still get issues, feel free to reopen.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants