Radish alpha
r
rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5
Radicle web interface
Radicle
Git
archive: Various Fixes
Open lorenz 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 9d9649d9 on base 2fe35668 +52 -22 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.
did:key:z6MkkfM3...sVz5 reviewed · 1 comment 1 year ago
lorenz pushed revision 2 e2f7e740 on base 2fe35668 +78 -32 1 year ago

Bring back refname into filename after review.

did:key:z6MkkfM3...sVz5 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 8bf24f67 on base 2fe35668 +78 -32 1 year ago

Run clippy.