0

I recently installed owncloud on my server and it is great!

But I want to modify the manner the share URL is generated. Where can I find the file responsible for creating that URL?

1 Answer 1

0

The URL itself seems to be hardcoded (eww…) in the file sharing API:

$url = \OCP\Util::linkToPublic('files&t='.$token);

If you would like to change how the token is generated, see this function.

public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) { …

More specifically this line:

$token = \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate( …
6
  • Where is the file located? I searched in the apps/files_sharing/lib/api.php but couldn't find the lines you gave me. Dec 5, 2014 at 19:46
  • Perhaps you are running an older version of OwnCloud. I just linked to the most recent one on GitHub. If you search the source code for key terms such as the linkToPublic('files&t='.$token); part, I'm sure you'll find it.
    – slhck
    Dec 5, 2014 at 19:51
  • Yup I found it. But I would like to know, is the value of $url the full url as http://dl.xxxx.org/public.php?service=files&t=4617c2d4e806fa0d8bf6f47e4123f695 in my case? Or is only a part of it? Dec 5, 2014 at 19:55
  • Yes, the result is the full URL, including hostname and protocol. (At least that's what the test checks for)
    – slhck
    Dec 5, 2014 at 19:57
  • Great thank you! But one last thing, how do I apply the changes once I modified the code? It doesn't appear to apply the moment I edit it. Dec 5, 2014 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .