File tree Expand file tree Collapse file tree 7 files changed +30
-14
lines changed
Expand file tree Collapse file tree 7 files changed +30
-14
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @vercel/blob ' : patch
3+ ---
4+
5+ Fix bad detection of Request being a plain object
Original file line number Diff line number Diff line change 6363 "async-retry" : " ^1.3.3" ,
6464 "bytes" : " ^3.1.2" ,
6565 "is-buffer" : " ^2.0.5" ,
66- "is-plain-object" : " ^5.0.0" ,
6766 "undici" : " ^5.28.4"
6867 },
6968 "devDependencies" : {
Original file line number Diff line number Diff line change @@ -63,3 +63,21 @@ export function getDownloadUrl(blobUrl: string): string {
6363
6464 return url . toString ( ) ;
6565}
66+
67+ // Extracted from https://github.com/sindresorhus/is-plain-obj/blob/main/index.js
68+ // It's just nearly impossible to use ESM modules with our current setup
69+ export function isPlainObject ( value : unknown ) : boolean {
70+ if ( typeof value !== 'object' || value === null ) {
71+ return false ;
72+ }
73+
74+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- ok
75+ const prototype = Object . getPrototypeOf ( value ) ;
76+ return (
77+ ( prototype === null ||
78+ prototype === Object . prototype ||
79+ Object . getPrototypeOf ( prototype ) === null ) &&
80+ ! ( Symbol . toStringTag in value ) &&
81+ ! ( Symbol . iterator in value )
82+ ) ;
83+ }
Original file line number Diff line number Diff line change 1- import { isPlainObject } from 'is-plain-object' ;
2- import { BlobError , type CommonCreateBlobOptions } from '../helpers' ;
1+ import {
2+ BlobError ,
3+ isPlainObject ,
4+ type CommonCreateBlobOptions ,
5+ } from '../helpers' ;
36import type { CreatePutMethodOptions , PutBody } from '../put-helpers' ;
47import { createPutHeaders , createPutOptions } from '../put-helpers' ;
58import { completeMultipartUpload } from './complete' ;
Original file line number Diff line number Diff line change 11import bytes from 'bytes' ;
22import type { BodyInit } from 'undici' ;
3- import { isPlainObject } from 'is-plain-object' ;
43import { BlobServiceNotAvailable , requestApi } from '../api' ;
54import { debug } from '../debug' ;
65import {
76 type CommonCreateBlobOptions ,
87 type BlobCommandOptions ,
98 BlobError ,
9+ isPlainObject ,
1010} from '../helpers' ;
1111import { createPutHeaders , createPutOptions } from '../put-helpers' ;
1212import type { PutBody , CreatePutMethodOptions } from '../put-helpers' ;
Original file line number Diff line number Diff line change 11import type { BodyInit } from 'undici' ;
2- import { isPlainObject } from 'is-plain-object' ;
32import { requestApi } from './api' ;
43import type { CommonCreateBlobOptions } from './helpers' ;
5- import { BlobError } from './helpers' ;
4+ import { BlobError , isPlainObject } from './helpers' ;
65import { uncontrolledMultipartUpload } from './multipart/uncontrolled' ;
76import type {
87 CreatePutMethodOptions ,
You can’t perform that action at this time.
0 commit comments