archive: Various Fixes
- When
git archiveerrors, do not require an exit code, but just use theExitStatuswe already have. This requires less unwrapping. Also, the previous default of 0 was misleading, since 0 is returned upon successful termination. - 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.
- 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. char::is_asciidoes not help sanitize refnames to file names. In particular we have'/'.is_ascii() == true. Use the full commit ID instead.
2 files changed
+78
-32
2fe35668
→
af334bb0
modified radicle-httpd/src/error.rs
@@ -86,8 +86,8 @@ pub enum RawError {
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
|
|
|
modified radicle-httpd/src/raw.rs
@@ -22,6 +22,8 @@ use crate::error::RawError as Error;
|
|
|
|
|
|
| + | |
| + | |
|
|
|
|
|
@@ -96,13 +98,39 @@ static MIMES: &[(&str, &str)] = &[
|
|
|
|
|
|
| + | |
|
|
|
|
| - | |
| + | |
|
|
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -121,10 +149,18 @@ async fn file_by_commit_handler(
|
|
|
|
|
|
| - | |
| - | |
| + | |
| + | |
|
|
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
@@ -137,24 +173,18 @@ async fn archive_by_refspec_handler(
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
| - | |
|
|
|
|
|
@@ -163,22 +193,38 @@ async fn archive_by_refspec_handler(
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
|
|
|
| - | |
| - | |
| - | |
| - | |
| - | |
| + | |
|
|
|
|
|