(_ context.Context, t core.SimpleType, filePath string)
| 39 | } |
| 40 | |
| 41 | func (u Uploader) handleSimpleType(_ context.Context, t core.SimpleType, filePath string) (*core.Literal, error) { |
| 42 | fpath, info, err := IsFileReadable(filePath, true) |
| 43 | if err != nil { |
| 44 | return nil, err |
| 45 | } |
| 46 | if info.IsDir() { |
| 47 | return nil, fmt.Errorf("expected file for type [%s], found dir at path [%s]", t.String(), filePath) |
| 48 | } |
| 49 | if info.Size() > maxPrimitiveSize { |
| 50 | return nil, fmt.Errorf("maximum allowed filesize is [%d], but found [%d]", maxPrimitiveSize, info.Size()) |
| 51 | } |
| 52 | b, err := os.ReadFile(fpath) |
| 53 | if err != nil { |
| 54 | return nil, err |
| 55 | } |
| 56 | return coreutils.MakeLiteralForSimpleType(t, string(b)) |
| 57 | } |
| 58 | |
| 59 | func (u Uploader) handleBlobType(ctx context.Context, localPath string, toPath storage.DataReference) (*core.Literal, error) { |
| 60 | fpath, info, err := IsFileReadable(localPath, true) |
no test coverage detected