@uploadcare/upload-client 6.0.1-alpha.1 → 6.0.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.browser.js
CHANGED
|
@@ -257,6 +257,10 @@ const getFileOptions = ({ name }) => name ? [name] : [];
|
|
|
257
257
|
const transformFile = identity;
|
|
258
258
|
var getFormData = () => new FormData();
|
|
259
259
|
|
|
260
|
+
const isReactNativeUri = (uri) => {
|
|
261
|
+
return uri.startsWith('file:') || uri.startsWith('content:');
|
|
262
|
+
};
|
|
263
|
+
|
|
260
264
|
/**
|
|
261
265
|
* FileData type guard.
|
|
262
266
|
*/
|
|
@@ -265,7 +269,7 @@ const isFileData = (data) => {
|
|
|
265
269
|
((typeof Blob !== 'undefined' && data instanceof Blob) ||
|
|
266
270
|
(typeof File !== 'undefined' && data instanceof File) ||
|
|
267
271
|
(typeof Buffer !== 'undefined' && data instanceof Buffer) ||
|
|
268
|
-
(typeof data === 'string' && data
|
|
272
|
+
(typeof data === 'string' && isReactNativeUri(data))));
|
|
269
273
|
};
|
|
270
274
|
/**
|
|
271
275
|
* Uuid type guard.
|
package/dist/index.node.js
CHANGED
|
@@ -285,6 +285,10 @@ const getFileOptions = ({ name, contentType }) => [
|
|
|
285
285
|
const transformFile = identity;
|
|
286
286
|
var getFormData = () => new NodeFormData();
|
|
287
287
|
|
|
288
|
+
const isReactNativeUri = (uri) => {
|
|
289
|
+
return uri.startsWith('file:') || uri.startsWith('content:');
|
|
290
|
+
};
|
|
291
|
+
|
|
288
292
|
/**
|
|
289
293
|
* FileData type guard.
|
|
290
294
|
*/
|
|
@@ -293,7 +297,7 @@ const isFileData = (data) => {
|
|
|
293
297
|
((typeof Blob !== 'undefined' && data instanceof Blob) ||
|
|
294
298
|
(typeof File !== 'undefined' && data instanceof File) ||
|
|
295
299
|
(typeof Buffer !== 'undefined' && data instanceof Buffer) ||
|
|
296
|
-
(typeof data === 'string' && data
|
|
300
|
+
(typeof data === 'string' && isReactNativeUri(data))));
|
|
297
301
|
};
|
|
298
302
|
/**
|
|
299
303
|
* Uuid type guard.
|
|
@@ -249,9 +249,13 @@ const request = ({ method, url, data, headers = {}, signal, onProgress }) => new
|
|
|
249
249
|
}
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
+
const isReactNativeUri = (uri) => {
|
|
253
|
+
return uri.startsWith('file:') || uri.startsWith('content:');
|
|
254
|
+
};
|
|
255
|
+
|
|
252
256
|
const getFileOptions = ({ name }) => name ? [name] : [];
|
|
253
257
|
const transformFile = (file, name) => {
|
|
254
|
-
if (typeof file === 'string' &&
|
|
258
|
+
if (typeof file === 'string' && isReactNativeUri(file)) {
|
|
255
259
|
return { uri: file, name };
|
|
256
260
|
}
|
|
257
261
|
const uri = URL.createObjectURL(file);
|
|
@@ -268,7 +272,7 @@ const isFileData = (data) => {
|
|
|
268
272
|
((typeof Blob !== 'undefined' && data instanceof Blob) ||
|
|
269
273
|
(typeof File !== 'undefined' && data instanceof File) ||
|
|
270
274
|
(typeof Buffer !== 'undefined' && data instanceof Buffer) ||
|
|
271
|
-
(typeof data === 'string' && data
|
|
275
|
+
(typeof data === 'string' && isReactNativeUri(data))));
|
|
272
276
|
};
|
|
273
277
|
/**
|
|
274
278
|
* Uuid type guard.
|