fix: file support for electron renderer#12
Merged
vasco-santos merged 2 commits intomainfrom Jul 23, 2021
Merged
Conversation
Gozala
approved these changes
Jul 22, 2021
Contributor
Gozala
left a comment
There was a problem hiding this comment.
Might be good idea to also rename lib.node.js to something less misleading now that it's also deals with electron.
file/src/lib.node.js
Outdated
Contributor
There was a problem hiding this comment.
Why not this ?
Suggested change
| const File = typeof XMLHttpRequest === 'function' ? globalThis.File : WebFile | |
| const File = typeof globalThis.File === 'function' ? globalThis.File : WebFile |
1762816 to
5d7a089
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous PR to fix browser export was not enough. File in electron renderer does not use the browser export and uses Node.js, causing ipfs/js-ipfs#3750 CI job in electron renderer to fail.
I think this is the cleanest solution, I moved the File implementation to a new fail, and add a fallback in Node.js.
The Blob implementation has the same issue (does not affect my other PR), if you like this solution I can fix Blob in a next PR