Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should throw error when a JSON instead of a File is received from client #175

Closed
HosseinAgha opened this issue Dec 23, 2019 · 1 comment · Fixed by #181
Closed

Should throw error when a JSON instead of a File is received from client #175

HosseinAgha opened this issue Dec 23, 2019 · 1 comment · Fixed by #181
Assignees
Labels

Comments

@HosseinAgha
Copy link

HosseinAgha commented Dec 23, 2019

When I send a JSON (number, string, object, etc) instead of a File from client, I don't get any errors and the argument returns a JS Object instead of Promise<FileUpload>.
Is this working correctly? Shouldn't this throw an error in the parseValue of scalar? We are expecting a stream after all.
This forces us to validate the input every time we are using Upload scalar.

I'm using Apollo Server (and apollo-upload-client which does not matter in this scenario)

@HosseinAgha HosseinAgha changed the title Should throw error when a JSON instead of a File sent in variables Should throw error when a JSON instead of a File is received from client Dec 23, 2019
@mike-marcacci
Copy link
Collaborator

Thanks for the report @HosseinAgha. I can confirm what you're describing: when a variable of type Upload is provided by a variable but is not supplied in the request (that is, not present in the map), the contents of the variable are never replaced. This should indeed cause an error.

mike-marcacci added a commit that referenced this issue Dec 23, 2019
@jaydenseric jaydenseric self-assigned this Jan 17, 2020
jaydenseric added a commit that referenced this issue Jan 19, 2020
Ensure `GraphQLUpload` scalar errors when parsing invalid values, fixing #175 .
krasivyy3954 added a commit to krasivyy3954/react-graphql-upload that referenced this issue Jan 6, 2023
krasivyy3954 added a commit to krasivyy3954/react-graphql-upload that referenced this issue Jan 6, 2023
Ensure `GraphQLUpload` scalar errors when parsing invalid values, fixing jaydenseric/graphql-upload#175 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants