~aw/mygit#35: 
path clash: static resources/repos

Currently there is a problem of differentiating between the static files and repositories. For example I could not create a repository that is called "robots.txt" or "style.css" (or now also "mail"). Retrieving static resources actually does not work at the moment because of this: When trying to get the stylesheet, mygit thinks I am looking for a repository called "style.css" and 404s because I do not have such a repo.

A solution could be to move the repos to a separate subtree, e.g. example.com/repos/mygit for git content. This would also make sense to separate from the mail subtree. The idea would be:

/ is a landing page linking to both the git part and the mail part (maybe already with a listing of repositories and the respective locations each)

/repos/ is what is now the root

/mail/, /style.css, /robots.txt stay where they are

Alternatively, I think we might also be able to solve it just for style.css and robots.txt by removing this line https://git.alexwennerberg.com/mygit/tree/7214333bfde1bde5f7c8de8dcf2405729328e689/item/src/main.rs#L640 (which is the line that unintentionally reroutes the style.css and robots.txt and causes them to 404), but that would still leave the /mail/ directory and thus not being able to serve a repo that is called "mail".

Status
REPORTED
Submitter
Johann Galle
Assigned to
No-one
Submitted
6 months ago
Updated
6 months ago
Labels
No labels applied.

~aw 6 months ago

The solution that I am thinking for this is just make the style.css path customizable,or maybe allow users to serve everything in a subdomain.

I like the simplicity of git.mydomain.com/reponame.git and I think would want to preserve that if possible. It seems rare that someone would want a repo named "style.css" or "robots.txt" or "mail" or any other reserved words.

I am envisioning that the full path is configurable -- so you could set the repos to live at git.alexwennerberg.com, alexwennerberg.com/git, etc. That way if you have trouble with paths you could set something like this.

Alex

On Tue Mar 30, 2021 at 11:05 AM PDT, Johann Galle wrote:

Currently there is a problem of differentiating between the static files and repositories. For example I could not create a repository that is called "robots.txt" or "style.css" (or now also "mail"). Retrieving static resources actually does not work at the moment because of this: When trying to get the stylesheet, mygit thinks I am looking for a repository called "style.css" and 404s because I do not have such a repo.

A solution could be to move the repos to a separate subtree, e.g. example.com/repos/mygit for git content. This would also make sense to separate from the mail subtree. The idea would be:

/ is a landing page linking to both the git part and the mail part (maybe already with a listing of repositories and the respective locations each)

/repos/ is what is now the root

/mail/, /style.css, /robots.txt stay where they are

Alternatively, I think we might also be able to solve it just for style.css and robots.txt by removing this line https://git.alexwennerberg.com/mygit/tree/7214333bfde1bde5f7c8de8dcf2405729328e689/item/src/main.rs#L640 (which is the line that unintentionally reroutes the style.css and robots.txt and causes them to 404), but that would still leave the /mail/ directory and thus not being able to serve a repo that is called "mail".

-- View on the web: https://todo.sr.ht/~aw/mygit/35

Johann Galle 6 months ago · edit

On 2021-04-02, Alex Wennerberg wrote:

[...] I like the simplicity of git.mydomain.com/reponame.git and I think would want to preserve that if possible. It seems rare that someone would want a repo named "style.css" or "robots.txt" or "mail" or any other reserved words.

I agree, the better solution is probably to explicitly add the static file paths to tide. This way they should be prioritized.

Register here or Log in to comment, or comment via email.