-
-
Notifications
You must be signed in to change notification settings - Fork 325
fix: Cloud files throwing error on upload #685
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,8 +170,28 @@ class AjaxUploader extends Component<UploadProps> { | |
| } | ||
| } | ||
|
|
||
| uploadFiles = (files: File[]) => { | ||
| const originFiles = [...files] as RcFile[]; | ||
| cacheFiles = async (files: File[]): Promise<RcFile[]> => { | ||
| if (files?.length) { | ||
| const filesArray = [...files]; | ||
|
|
||
| const cachedFiles = await Promise.all( | ||
| filesArray.map(async file => { | ||
| const buffer = await file.arrayBuffer(); | ||
| return new File([buffer], file.name, { | ||
| type: file.type, | ||
| lastModified: file.lastModified, | ||
| }); | ||
| }), | ||
| ); | ||
|
|
||
| return cachedFiles as RcFile[]; | ||
| } | ||
|
|
||
| return []; | ||
| }; | ||
|
|
||
| uploadFiles = async (files: File[]) => { | ||
| const originFiles = await this.cacheFiles(files); | ||
|
||
| const postFiles = originFiles.map((file: RcFile & { uid?: string }) => { | ||
| // eslint-disable-next-line no-param-reassign | ||
| file.uid = getUid(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other file attributes would be lost.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve attached a screenshot after printing the original and cloned File objects, and I don’t see any difference in their attributes. Please let me know if I’m missing something.