Skip to content

Panic when using autometa header first in blob upload #453

@shorsher

Description

@shorsher

When attempting to upload a data blob, FireFly will panic when the autometa header is first

curl:

curl --location --request POST 'http://localhost:5000/api/v1/namespaces/default/data' \
--form 'autometa="true"' \
--form 'file=@"/Users/shorsher/Downloads/test-invoice.pdf"'

Logs:

2022/01/27 14:18:01 http: panic serving [::1]:55659: runtime error: invalid memory address or nil pointer dereference
goroutine 4234 [running]:
net/http.(*conn).serve.func1()
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:1801 +0x13a
panic({0x4d71e00, 0x549ec40})
	/usr/local/Cellar/go/1.17.2/libexec/src/runtime/panic.go:1047 +0x262
github.com/hyperledger/firefly/internal/data.(*blobStore).UploadBLOB(0xc0000fc800, {0x4f2bf38, 0xc000a8d0b0}, {0xc0002a86d8, 0x7}, 0xc00032d400, 0xc000a8d020, 0x1)
	/Users/shorsher/repositories/firefly/internal/data/blobstore.go:106 +0x4e9
github.com/hyperledger/firefly/internal/apiserver.glob..func165(0xc00067ea20)
	/Users/shorsher/repositories/firefly/internal/apiserver/route_post_data.go:77 +0x606
github.com/hyperledger/firefly/internal/apiserver.(*apiServer).routeHandler.func1({0x4f253f8, 0xc00036ed20}, 0xc000874900)
	/Users/shorsher/repositories/firefly/internal/apiserver/server.go:269 +0xc17
github.com/hyperledger/firefly/internal/apiserver.(*apiServer).apiWrapper.func1({0x4f253f8, 0xc00036ed20}, 0xc000874900)
	/Users/shorsher/repositories/firefly/internal/apiserver/server.go:363 +0x363
net/http.HandlerFunc.ServeHTTP(0xc0002ce2a0, {0x4f253f8, 0xc00036ed20}, 0xc000874800)
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:2046 +0x43
github.com/gorilla/mux.(*Router).ServeHTTP(0xc000182000, {0x4f253f8, 0xc00036ed20}, 0xc000874800)
	/Users/shorsher/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x262
github.com/rs/cors.(*Cors).Handler.func1({0x4f253f8, 0xc00036ed20}, 0xc000874600)
	/Users/shorsher/go/pkg/mod/github.com/rs/cors@v1.8.2/cors.go:231 +0x306
net/http.HandlerFunc.ServeHTTP(0xc0006c72a0, {0x4f253f8, 0xc00036ed20}, 0xc000874600)
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:2046 +0x43
net/http.serverHandler.ServeHTTP({0xc0003e6380}, {0x4f253f8, 0xc00036ed20}, 0xc000874600)
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:2878 +0x47a
net/http.(*conn).serve(0xc00017f0e0, {0x4f2be90, 0xc00032c980})
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:1929 +0x18b8
created by net/http.(*Server).Serve
	/usr/local/Cellar/go/1.17.2/libexec/src/net/http/server.go:3033 +0xa38

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions