Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
archive: Various Fixes
lorenz wants to merge 1 commit into master · opened 1 year ago
  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. Use the full commit ID instead.
lorenz opened with revision 9d9649d9c117acfaf40d17dd2de54c1169cc5758 on base 2fe3566848e4b11d5f17b4baa0fa8ea9f7c06754 +52 -22 1 year ago
sebastinez reviewed · 1 comment 1 year ago
lorenz pushed revision 2 e2f7e740f3bdbfdc6457a3bf55185059e5e9de33 on base 2fe3566848e4b11d5f17b4baa0fa8ea9f7c06754 +78 -32 1 year ago

Bring back refname into filename after review.

sebastinez reviewed 1 year ago

Thanks @lorenz, patch looks pretty good to me, I got a few issues from clippy here that you maybe could fix?

> radicle-explorer@1.0.0 check:radicle-httpd
> cd radicle-httpd && cargo clippy --all --tests && cargo fmt --all --check

   Compiling radicle-httpd v0.18.1 (/Users/sebastinez/Projects/radicle-explorer/radicle-httpd)
warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> src/raw.rs:127:22
    |
127 |     if Oid::from_str(&sha).is_err() {
    |                      ^^^^ help: change this to: `sha`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

warning: calling `push_str()` using a single-character string literal
   --> src/raw.rs:209:9
    |
209 |         build.push_str("-");
    |         ^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `build.push('-')`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
    = note: `#[warn(clippy::single_char_add_str)]` on by default

warning: calling `push_str()` using a single-character string literal
   --> src/raw.rs:215:13
    |
215 |             build.push_str("-");
    |             ^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `build.push('-')`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str
lorenz pushed revision 3 8bf24f6779617c02ca5ac58efb8534fe3dc94529 on base 2fe3566848e4b11d5f17b4baa0fa8ea9f7c06754 +78 -32 1 year ago

Run clippy.