Redirect trees to blobs and vice versa
Created by: felixfbecker
Extensions in code insights want to link to file paths and directories to support drilling into the details. Given how our URLs are structured, they currently need to know whether the file path is a directory or file to construct the URL. This information is not always available, and would require making a lot of API requests to determine eagerly.
We can be helpful by instead just redirecting a tree to a blob and vice versa if the file/directory turned out to be a directory/file. This also makes us return a proper 404 on not found files. Redirect is implemented both in the client and the backend (to support internal and external links).
Please give extra care to my Go code