Import imports an exported context into a store
(name string, s Writer, reader io.Reader)
| 352 | |
| 353 | // Import imports an exported context into a store |
| 354 | func Import(name string, s Writer, reader io.Reader) error { |
| 355 | // Buffered reader will not advance the buffer, needed to determine content type |
| 356 | r := bufio.NewReader(reader) |
| 357 | |
| 358 | importContentType, err := getImportContentType(r) |
| 359 | if err != nil { |
| 360 | return err |
| 361 | } |
| 362 | switch importContentType { |
| 363 | case zipType: |
| 364 | return importZip(name, s, r) |
| 365 | default: |
| 366 | // Assume it's a TAR (TAR does not have a "magic number") |
| 367 | return importTar(name, s, r) |
| 368 | } |
| 369 | } |
| 370 | |
| 371 | func isValidFilePath(p string) error { |
| 372 | if p != metaFile && !strings.HasPrefix(p, "tls/") { |
searching dependent graphs…