Resolve links to submodule files

This is probably best explained with an example. The Adminer project tracks third party designs, which is now incorporating submodules as they are much simpler and more efficient than a forked repository. The theme files that are not (yet) submodules are accessible via the URLs like:

Those in submodules currently 404 if one attempts to access them by their old/expected URL like:

They are only accessible via their own repo’s URL structure like:

It would make accessing the files clean, consistent, and easy, and preserve public URLs when subdirs are later converted to submodules.

Other examples of this are collection-type repositories, such as Noah’s vim themes.

I’m afraid this is not possible, since the URL pointing to a submodule file is not correctly resolved by GitHub due to redirection to the original repository.

The “preserve public URLs when subdirs are later converted to submodules” part is problematic, looks like you’ll have to set up your own URL redirection system. I’m not aware of any public service offering URL redirections which can later on be updated — there are obvious safety concerns, because a link turned popular could suddenly be redirected to a malicious site.

If you have a running server somewhere that you can use for this, you might either setup a CGI script somewhere to handle redirections based on whether the URL includes a submoduled folder or not, or rely on some .htaccess file and mod rewrite rules.

@tajmone This post was meant to be tagged feature-request, and is not a general request for help. I guess I stuffed up when posting it, and don’t see a way to fix it. Maybe a staff member like @andreagriffiths11 could add that tag to the post?

You could still change the title to something like “Feature Request: Allow Raw Linking to Files in Submodules”.

From a community perspective, I don’t see anything wrong with other users who might have faced the same problem to discuss the nature of why the problem is there and share known or possible solutions. It makes more sense to keep discussions together than create separate threads for a same topic — but that’s only my opinion. Also, feature requests can take up time to become effective, so suggested solutions can provide immediate workarounds.

I still think that there might be security concerns for this type of links resolution, for the linked content is outside of the repository owner control — e.g. if a submodule points to a specific branch or tag, since the submoduled repository can always force push its contents for that branch or tag.

Anyhow, no harm or offense intended.

I’m unable to do this. Maybe my trust level isn’t high enough?

Sure, but this is specifically about how GitHub servers link to content, over which users have zero control.

No, submodules are always a link to a specific commit, so GitHub redirecting to a submodule file at a known point in its history would increase security, not decrease it.

Your post isn’t even slightly offensive :slight_smile: Sorry to have taken up your time trying to solve a problem that only GitHub really can.