|
...
|
...
|
@@ -344,15 +344,6 @@ func TruncateId(id string) string {
|
|
344
|
344
|
|
|
345
|
345
|
// Code c/c from io.Copy() modified to handle escape sequence
|
|
346
|
346
|
func CopyEscapable(dst io.Writer, src io.ReadCloser) (written int64, err error) {
|
|
347
|
|
- // If the writer has a ReadFrom method, use it to do the copy.
|
|
348
|
|
- // Avoids an allocation and a copy.
|
|
349
|
|
- if rt, ok := dst.(io.ReaderFrom); ok {
|
|
350
|
|
- return rt.ReadFrom(src)
|
|
351
|
|
- }
|
|
352
|
|
- // Similarly, if the reader has a WriteTo method, use it to do the copy.
|
|
353
|
|
- if wt, ok := src.(io.WriterTo); ok {
|
|
354
|
|
- return wt.WriteTo(dst)
|
|
355
|
|
- }
|
|
356
|
347
|
buf := make([]byte, 32*1024)
|
|
357
|
348
|
for {
|
|
358
|
349
|
nr, er := src.Read(buf)
|