icyleaf/gitlab.cr

fix correct response to get file archive in repository api

Closed this issue · 1 comments

For now, in gitlab.cr api client.file_archive will always throw exception:

Unexpected byte 0x8b at position 1, malformed UTF-8 (InvalidByteSequenceError)
[4462170210] *CallStack::unwind:Array(Pointer(Void)) +82
[4462170113] *CallStack#initialize:Array(Pointer(Void)) +17
[4462170072] *CallStack::new:CallStack +40
[4462129593] *raise<InvalidByteSequenceError>:NoReturn +25
[4462357812] *Char::Reader#invalid_byte_sequence<UInt32, Int32>:NoReturn +148
[4462356825] *Char::Reader#decode_current_char:Char +153
[4462357894] *Char::Reader#next_char:Char +54
[4462203146] *String#inspect<IO::FileDescriptor>:IO::FileDescriptor +266
[4462152813] *p<String>:String +29
[4462090810] __crystal_main +1370
[4462141208] main +40
"\u{1f}%

This is because the "Content-Type" of HTTP::Response is "application/octet-stream", but code just return it as String.

done in d14cf2a