@uploadcare/upload-client 6.0.1-alpha.3 → 6.0.1-alpha.4
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.
|
@@ -258,13 +258,13 @@ const isReactNativeUri = (uri) => {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
const getFileOptions = ({ name }) => name ? [name] : [];
|
|
261
|
-
const transformFile = (file, name) => {
|
|
261
|
+
const transformFile = (file, name, contentType) => {
|
|
262
262
|
if (typeof file === 'string' && isReactNativeUri(file)) {
|
|
263
|
-
return { uri: file, name };
|
|
263
|
+
return { uri: file, name, type: contentType };
|
|
264
264
|
}
|
|
265
|
-
const uri = URL.createObjectURL(file)
|
|
266
|
-
const type = file.type
|
|
267
|
-
return
|
|
265
|
+
// const uri = URL.createObjectURL(file as BrowserFile)
|
|
266
|
+
// const type = contentType || (file as BrowserFile).type
|
|
267
|
+
return file;
|
|
268
268
|
};
|
|
269
269
|
var getFormData = () => new FormData();
|
|
270
270
|
|
|
@@ -312,7 +312,7 @@ const isFileValue = (value) => !!value &&
|
|
|
312
312
|
function collectParams(params, inputKey, inputValue) {
|
|
313
313
|
if (isFileValue(inputValue)) {
|
|
314
314
|
const { name, contentType } = inputValue;
|
|
315
|
-
const file = transformFile(inputValue.data, name); // lgtm [js/superfluous-trailing-arguments]
|
|
315
|
+
const file = transformFile(inputValue.data, name, contentType); // lgtm [js/superfluous-trailing-arguments]
|
|
316
316
|
const options = getFileOptions({ name, contentType });
|
|
317
317
|
params.push([inputKey, file, ...options]);
|
|
318
318
|
}
|