Question about Direct Links

Overall, got my Seafile server up and running with no issue, honestly super impressed with the optimization seeing I am running ours on an old core2duo system I have had laying around for years.

Thing I am encountering, I can’t seem to get the Direct Link option to work as an alternative to the type that Dropbox provides. How I am trying to use this is as follows:

I am creating a custom map repository for Patreon users of maps I create for the game RUST. When I try to put the Direct Link address in the game server for testing it encounters 2 issues…one stating IO Error, but its just a generic error code I suspect seeing the drives are new and test fine elsewhere. The second I get is another server generic read out stating Outdated file. On reading its due to permissions I gather with these types of links and how they are read to the RUST server.

Dropbox will work fine because the way they do links is /2jk3233k433/ but with seafile naming convention everything with the actual file name is omitted. Is there any way I produce a direct file name in the link? I am using this to host the repository of maps we create but also would like to provide our Patreons some hosting ability so they don’t have to physically self host our files for their servers.

This maybe impossible though and I get that due to the way files are secured on this. It seems for hosting map files with this game we can only do it with Dropbox or Discord both being pretty pricey for the amount of space I intend to need soon. Unsure if maybe there is some settings or something I am missing to pull direct file name links so figured I would ask in here.

Any help very appreciated, about to go live soon so want to make sure I can or can’t host these like this with our Seafile server

It sounds like you might eventually want to push those files to an amazon S3 bucket, or one of the cheaper alternatives that basically work the same, and then share from there. Even if you don’t now, if this gets big you probably will want to do that eventually to make the links faster and more reliable. You don’t need to make a VM and loadbalancer and all that, you can just set the permissions on the bucket and then for map.txt the link is http://[YourBucketName]

But for now, with seafile there are 2 ways I can think of.

First is almost exactly what you already did. Share the file, and then just add the file name. So if it the share link is ht tps://your-seafile/f/8b1a51c2aea945efb686/?dl=1 just add &filename=map.txt to make ht tps://your-seafile/f/8b1a51c2aea945efb686/?dl=1&filename=map.txt . Seafile will just ignore the extra filename argument it wasn’t expecting, so the link will work if the filename is wrong, or missing or whatever, but whoever you send it to probably won’t mess with it. It’s not clear to me if that does what you want. It puts the filename in the URL, but might not get to why you want to do that.

The other way is to share a folder and then you can link to the individual files inside. So if you share a folder, then visit the share link, you can right-click the link to a file, and it looks like http s:// Just add the &dl=1 to that to make it download immediately instead of showing the web page with the preview. http s:// Again I am not clear on why you want the filename in the URL, but that might work for you.

Also it might help to know that %2F is a / and %20 is a space, so don’t be surprised to see those in your links, and don’t change them.

Do either of those work for you?

Thank you for the help. Sadly though all the options listed didn’t didn’t work. Almost thought we would have something with the &filename=map.txt but throws out this error which is so generic with these game servers:

IOException: Win32 IO returned ERROR_INVALID_NAME. Path: C:\RSM FX Test\server\rsm?dl=1&

I also tried to do the direct link from the share link but it tosses out the same error. Soon as I try the same file via Dropbox, always works so I am thinking something with permissions or something from game server side throws things off. This is a usual pain with Rust game servers, it needs to basically get to the file, verify its a .map file then it will download it to the server and then from there players will be fed that same file via the game server itself.

Far as hosting, bare minimum for something like this is 1 core so I should be fine with my setup for just map file serving but I plan to upgrade as we grow things. But I do appreciate the heads up about Amazon there, I actually sit on a spare i9 9900k system, just has a few issues going on so its a potential option if I need it.

Not sure what causes this to not grab from the server on Seafile. Funny thing I do get a different error when I just use the Direct link as is, saying I am using an outdated file so its appearing to see it there but I guess something is conflicting from that stage on seeing the file is brand new off the recent patch for the game itself.

I am gonna hit up some admins in this game and see if maybe they know why I am getting such errors but its not just Seafile, I can’t get it to work with Onedrive, tried NextCloud and a few other open source options but get the same results.

If I find a fix I will post it here in case anyone in the future tries to serve files this way to games, sure there is a workaround somehow

I see now. You aren’t getting the files with a browser to load into the game but have the game downloading the file for itself, so now this makes more sense to me. I don’t know of a way to work around that with seafile.

The ERROR_INVALID_NAME is probably because in windows you can’t have a ? or a & in the filename, and the program is just using everything from the last / to the end of the address as the filename. So they might need to filter out such characters or something.

The closest I can think of is to modify the the apache or nginx that you run in front of seafile to point a path to a directory on your server. I don’t remember the configuration exactly, but I think nginx you would have “location /maps” and “root /var/www/static” lines in your conifg. Then https://server/maps/map.txt would give you the file /var/www/static/map.txt, and that directory could be synced with the seafile client. That removes seafile from being involved, so might not be ideal if you were using seafile to authenticate users, but worth a try at least.

Good luck

It looks like the game has a severe bug. It does not verify whether the filename is valid or not. It also doesn’t respect the content-disposition header. I wouldn’t be surprised when there is a path traversal vulnerability.