How do I modify the "create a new share link"

I have Nexcloud 23 running on Ubuntu.
When I create a new share link Nexcloud creates that link and copies the link to clipboard.
Somethink like http://localhost/index.php/s/f5itJz3qZEzoLPe

Where is the PHP/JS file where the code for that happens (copy to clipboard)?

I wan’t to mody file it for testing purposes. I’d modify it to say, http://localhost/index.php/s/f5itJz3qZEzoLPe?HelloWord

Should contain everything you are looking for

Thanks for the reply but I could not get a change in the program.
There were two lines that had the “/s/” parameters but changing those did not result any changes in program execution. The link remains the same even if I change those lines.

return OC.generateUrl('/s/' + token ..

ofc it stays the same. You asked where the URL is being generated, i found the file for you. It’ll take some more programming to change how the url is generated.

I modified public.js and inserted many alert(“hello”) -code snippets. None of them gets triggered. I don’t think public.js is executed when I click the “+” button to “create a new share link”.

Hi. Maybe you search the app ShareRenamer.



I tried that and also the “Configurable Share Links”. Unfortunately they and not what I am looking for. I am trying to make an automated “rename-link” of sorts and need to do custom coding. So I need to find the code part where the link name is created so I can add some extra code there.

So this is what you’re looking for. server/routes.php at master · nextcloud/server · GitHub
You’ll need to pass the Token tho, otherwise you wont get any working link. It would be smarter to make another url alias. For example make redirect to

For whatever reason you would need this anyways

I’m using an URL-shortener for that:

I have installed the NC instance on domain.xx and the URL-shortener on www.domain.xx

That will give me instead of


a short link like


I would appreciate if someone could implement that feature to Nextcloud.

This is def. the better Solution. You’d have to remake your changes after every update otherwise.

And yes, that feature would be cool although it is not needed imo. You could still make it a feature request if you want

1 Like