Skip to content

Commit

Permalink
Merge pull request #1683 from orhtej2/patch-1
Browse files Browse the repository at this point in the history
Allow installation from gitea
  • Loading branch information
alexAubin authored Jul 3, 2023
2 parents 510e82f + 6f48cbc commit 42d74bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
)

APP_REPO_URL = re.compile(
r"^https://[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_./~]+/[a-zA-Z0-9-_.]+_ynh(/?(-/)?tree/[a-zA-Z0-9-_.]+)?(\.git)?/?$"
r"^https://[a-zA-Z0-9-_.]+/[a-zA-Z0-9-_./~]+/[a-zA-Z0-9-_.]+_ynh(/?(-/)?(tree|src/(branch|tag|commit))/[a-zA-Z0-9-_.]+)?(\.git)?/?$"
)

APP_FILES_TO_COPY = [
Expand Down
11 changes: 11 additions & 0 deletions src/tests/test_appurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,19 @@ def test_repo_url_definition():
assert _is_app_repo_url("git@github.com:YunoHost-Apps/foobar_ynh.git")
assert _is_app_repo_url("https://git.super.host/~max/foobar_ynh")

### Gitea
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh")
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/branch/branch_name")
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/tag/tag_name")
assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/commit/abcd1234")

### Invalid patterns

# no schema
assert not _is_app_repo_url("github.com/YunoHost-Apps/foobar_ynh")
# http
assert not _is_app_repo_url("http://github.com/YunoHost-Apps/foobar_ynh")
# does not end in `_ynh`
assert not _is_app_repo_url("https://github.com/YunoHost-Apps/foobar_wat")
assert not _is_app_repo_url("https://github.com/YunoHost-Apps/foobar_ynh_wat")
assert not _is_app_repo_url("https://github.com/YunoHost-Apps/foobar/tree/testing")
Expand Down

0 comments on commit 42d74bf

Please sign in to comment.