I would like to create a permanent link to share a file to people without accounts. My problem is that a share link point to a given path, if this path change (ex: parent directory is renamed) the link is dead.
Can I create a share link that is bounded to a file without any reference to is path ? (does each file is stored internally with a unique identifier ?).
I really need this feature, so if it’s not directly possible, can I imagine some other ways to achieve this ?
I can modify the seahub code, I’ve done it by the past and I know it pretty well now.
It is not possible with Seahub as is. But as long as you keep the history of your library you can reference the data. Seafile internally has a data structure similar to git. I think the best way to figure out the details for how you could add it is having a look at how one can currently download a file from the history.
A link looks like this. https://seafile.example.com/repo/library-uuid/commit-id/download/?file_name=filename.ending&p=/filepath/filename.ending
You can either change the share feature or add an option to share a specific file which will be referenced by commit id & path.
What you have to consider is, when you delete a file and have set a history limit it can be removed while running the garbage collector.
A different approach would be copying the file to a special library.
Hi, thank you for your answer !
If I have well understand you say that I can refer to a file via his commit_id and path, but it’s always the same content (I need to follow a file even if it’s content change), and I would like to refer without the path (because the path can change).
For now I’ve just create a script that ‘guess’ the right path of the file I need to share and create a new download link on the fly and then it send it as a 302 redirection.
This does not work with the way described above.
The links to exactly one version of a specific file. Even if that file is renamed or changed later it’ll be the old state of the file.
What you want seems to be hard to implement with Seafile - or at least I might not have a good idea how to it. (With the pro edition, the best I can think of is analyzing the file activity with some background and adjust references when a shared file is moved / whatever).