mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
Reorder the gitlab mirrors so GitLab Pages comes before "raw".
GitLab storage provides two mirrors by default: * https://gitlab.com/user/repo/raw/master/fdroid/repo * https://user.gitlab.io/repo/fdroid/repo While the F-Droid client will happily fetch the index*.jar files and parse them from either of these two mirrors, only the GitLab Pages mirror will serve files with the correct mime type. Many repos tend to put index.html files (and associated .css/.js/image files) in the root of a repository to provide information about that repo. One example is RepoMaker. The way in which RepoMaker decides the public URL of a repo, is to take the first mirror in the list. This means that the URL which RepoMaker directs people to for GitLab storage returns a .html document in text/plain, which means that it is not rendered. We could change RepoMaker so that it takes the last mirror, and then it woruld work. However there is something nice about the first mirror in a list being the most authoritative (even though the mirror order doesn't - and perhaps shouldn't have any specific meaning).
This commit is contained in:
parent
56a53055be
commit
3180acc454
@ -649,12 +649,17 @@ def get_mirror_service_urls(url):
|
||||
segments.extend([branch, folder])
|
||||
urls.append('/'.join(segments))
|
||||
elif hostname == "gitlab.com":
|
||||
# Gitlab Raw "https://gitlab.com/user/repo/raw/branch/folder"
|
||||
gitlab_raw = segments + ['raw', branch, folder]
|
||||
urls.append('/'.join(gitlab_raw))
|
||||
# Both these Gitlab URLs will work with F-Droid, but only the first will work in the browser
|
||||
# This is because the `raw` URLs are not served with the correct mime types, so any
|
||||
# index.html which is put in the repo will not be rendered. Putting an index.html file in
|
||||
# the repo root is a common way for to make information about the repo available to end user.
|
||||
|
||||
# Gitlab-like Pages segments "https://user.gitlab.io/repo/folder"
|
||||
gitlab_pages = ["https:", "", user + ".gitlab.io", repo, folder]
|
||||
urls.append('/'.join(gitlab_pages))
|
||||
# Gitlab Raw "https://gitlab.com/user/repo/raw/branch/folder"
|
||||
gitlab_raw = segments + ['raw', branch, folder]
|
||||
urls.append('/'.join(gitlab_raw))
|
||||
return urls
|
||||
|
||||
return urls
|
||||
|
Loading…
Reference in New Issue
Block a user