Skip to content

Commit

Permalink
Merge pull request #9 from euanh/master
Browse files Browse the repository at this point in the history
impl: Strip leading slash from filename if prefix is supplied
  • Loading branch information
euanh committed Apr 9, 2014
2 parents 18b07e0 + 0758153 commit deadb9c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/impl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ let serve_tar_to_raw total_size c dest prezeroed progress expected_prefix ignore
else
let p_len = String.length p in
let file_name_len = String.length hdr.Tar.Header.file_name in
return (String.sub hdr.Tar.Header.file_name p_len (file_name_len - p_len)) ) >>= fun filename ->
let filename = String.sub hdr.Tar.Header.file_name p_len (file_name_len - p_len) in
return (Filename.basename filename)) >>= fun filename ->
let zero = Cstruct.sub header 0 (Tar.Header.compute_zero_padding_length hdr) in
(* either 'counter' or 'counter.checksum' *)
if endswith ".checksum" filename then begin
Expand Down

0 comments on commit deadb9c

Please sign in to comment.