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

fix: fileAPI upload endpoint #427

Merged
merged 2 commits into from
Sep 17, 2020
Merged

fix: fileAPI upload endpoint #427

merged 2 commits into from
Sep 17, 2020

Conversation

mrtraser
Copy link
Contributor

@mrtraser mrtraser commented Sep 17, 2020

Fixes upload endpoint of FilesAPI by preventing content-type header changes based on isJson check of the request body.
Previously, isJson returns true for ArrayBuffer request body type and set content-type: application/json header instead of provided content-type header in params.
[release]

@mrtraser mrtraser requested a review from a team as a code owner September 17, 2020 12:56
@mrtraser mrtraser requested a review from a team September 17, 2020 12:56
@codecov
Copy link

codecov bot commented Sep 17, 2020

Codecov Report

Merging #427 into master will increase coverage by 0.16%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master     #427      +/-   ##
==========================================
+ Coverage   88.76%   88.93%   +0.16%     
==========================================
  Files          63       63              
  Lines        1727     1726       -1     
  Branches      220      220              
==========================================
+ Hits         1533     1535       +2     
+ Misses        184      181       -3     
  Partials       10       10              
Impacted Files Coverage Δ
packages/core/src/utils.ts 89.61% <ø> (-0.14%) ⬇️
packages/stable/src/api/files/filesApi.ts 93.22% <0.00%> (+5.08%) ⬆️

@mrtraser mrtraser merged commit 9c12661 into master Sep 17, 2020
@@ -51,7 +50,8 @@ export function convertToTimestampToDateTime(timestamp: number): Date {
export function isJson(data: any) {
return (
(isArray(data) || isObject(data)) &&
!isBuffer(data) &&
!Buffer.isBuffer(data) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passes the test (runs in node) but crashes in a browser because there is no global Buffer in browsers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants