The result of `git archive` is written to memory and only then sent off
via the network.
Instead of buffering potentially large archives, stream the response
body.
Co-authored-by: Rūdolfs Ošiņš <rudolfs@osins.org>
`git archive` is executed for HEAD requests, even though the resulting
archive is never sent to the client.
Resolve this by taking the HTTP method as an argument an only producing
the archive if the request method is not HEAD.
GitHub and GitLab will prefix archive payloads with the name of the repo
and the refspec. This patch naively applies a prefix in similar fashion.
The refspec might contain filesystem path separators, like a forward
slash (`/`). GitHub and GitLab replace that with a hyphen (`-`). This
patch applies that same replacement.
The file name that is suggested to browsers (via the HTTP header
`Content-Disposition`) is changed to match the prefix.
The additional archive formats `tar` and `zip` are now supported as
well.
Users that relied on the archive *not* carrying the prefix introduced
here, may pass the query `?prefix=false` to get the old behavior.
This does not affect the `Content-Disposition` header, though. Users
who relied on the downloaded file be named in a certain way after,
and also used the file name from `Content-Disposition` for the name,
cannot get back the old behavior, but must instead rename the file.
Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>
Work around an issue where radicle-node takes a long time to respond to
status and config requests blocking the UI because we use the node
avatar from the config in almost all layouts.
radicle 0.18.0 -> 0.21.0
radicle-surf 0.22.0 -> 0.27.0
radicle-term 0.14.0 -> 0.17.0
radicle-crypto 0.13.0 -> 0.15.0
Fixes the following issues:
- broken pinned repo listing while repos are being fetched
- broken source tree browser when there are `[]` characters in folder names
This patch adds support for serving `/{rid}/{nid}/...` paths as
`GIT_NAMESPACE`-d http remotes, using `{nid}` as the namespace.
Radicle's on-disk repo storage already uses a Git-namespace-compatible
notion for peer refs (`refs/namespaces/*`), so it is merely a matter of
passing the right `$GIT_NAMESPACE` to the `git http-backend` process.
This way, it becomes possible to directly clone or fetch from URLs like
`http://httpd.domain.tld/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git/z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM`
to directly access the given node's ref namespace:
$ cd radicle-explorer
$ git remote add intelfx https://iris.radicle.xyz/z4V1sjrXqjvFdnCUbxPFqd5p4DtH5/z6MkqbVudjUcuxUmwWfW6U886CnhoX5wmkEDsAXju9F9UBAo
$ git pull intelfx work/httpd-git-namespace // or fetch, or ...
Instead of mucking about with
$ git fetch origin refs/namespaces/{nid}/refs/heads/{branch}:refs/heads/{branch}
Enable hot-reloading of web configuration (pinned repos, avatar, banner,
description) by sending SIGHUP to the process, eliminating the need for
server restarts when updating these settings.
Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
Try to determine the mime type of a file first based on its path, then
based on its content.
The previous behavior (looking only at the file content) inferred a
mime type of `text/xml` for `.svg` files (instead of `image/svg+xml`)
which prevented them from being shown when embedded e.g. in a markdown
document.
Required:
- removing the #[async_trait] declarations since that has been
stabilized in rust.
- axum 0.8.0 introduced new endpoints declarations with curly brackets.
The `-c` argument (and its corresponding value) must come *before* the
first subcommand to be effective. This error was introduced in commit
5f22e1bb77.
1. When `git archive` errors, do not require an exit code, but just use
the `ExitStatus` we already have. This requires less unwrapping.
Also, the previous default of 0 was misleading, since 0 is returned
upon successful termination.
2. Use "refname" instead of "refspec" as these are different concepts.
Refer to <https://git-scm.com/docs/git-check-ref-format> and in
particular
<https://git-scm.com/docs/git-check-ref-format#Documentation/git-check-ref-format.txt---refspec-pattern>.
3. Only allow appending ".tar.gz" to commit IDs, not to refnames,
because refnames may contain the suffix ".tar.gz". It might look
weird, but it is not forbidden to do `git branch foo.tar.gz`.
4. `char::is_ascii` does not help sanitize refnames to file names. In
particular we have `'/'.is_ascii() == true`. Replace forward slashes
with two underscores.
Instead of panicking when trying to handle non utf8 lines we should
return `null` as line output.
This way we can on the frontend detect if a file has any lines the api
wasn't able to parse and fallback to show a file as a `Binary File`
Turns out "content-type: text; charset=utf-8" wasn't valid, it had to be
"content-type: text/plain; charset=utf-8" for browsers to recognise it
properly.
The usage of the term `delegate` when handling a DID isn't explicit
enough, so this commit changes the places where the word `delegate` is
used when actually it's a DID.
Don't require a repo to have a `xyz.radicle.project` payload.
If there are issues with obtaining the repo `head`, issue count or patch
count, filter that repo from the list.