processing / processing/p5.js-web-editor
Allow to use files bigger than 80KB ?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 1.7k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 8
Description
Nature of issue?
Found a bug- Existing feature enhancement
Details about the bug:
Hello,
I have a project that I'm working on, it was still working fine 2 or 3 days ago, but now, even I didn't modify anything since then, I get errors about JSZip which is an external library that I included in my project by uploading the file "jszip.min.js" which is about 100KB. When looking at the Chrome dev console, I can now see this error, which I didn't get before:
Access to script at 'https://assets.editor.p5js.org/5e9d26bb08c6cb0020a92e9f/24243c71-2b80-4eb4-b0aa-de074734133d.js' from origin 'https://editor.p5js.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
When I tried to open this file "jszip.min.js" in the online editor, it was just an empty window, like there was nothing in the file, so I uploaded it again and still the same thing happening. While uploading I noticed that I didn't get the red message box "Uploading plaintext file locally" (small suggestion, change from red to something like green, because red looks like it's an error). Strangely, if you click the link in the error above, you can see the entire content of the file.
Now if I modify this file so that it is 79999 bytes long, then I can upload it and see the red message, I can open it in the online editor to see the content, and I don't get the error in the console (of course I get other errors and the file is unusable since I removed thousand lines of code from it).
I have no problems with other libraries that I have included, it's just this one and I really think it's because it's bigger than 80KB.
Thanks already if you can solve it by increasing the limit to maybe 1MB ? Or is there a workaround ?
- Web browser and version: Chrome v84.0.4147.89
- Operating System: Windows 10
EDIT: I remember now, that I previously used an online version of jszip by adding this line in my index.html file
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.5.0/jszip.min.js"></script>
Then I decided to use a local version. Maybe it was still working because the online version was still inside Chrome's cache ? I can now see that the limit is set here and it's not a recent addition: https://github.com/processing/p5.js-web-editor/blob/master/client/modules/IDE/actions/uploader.js#L9 . Still, if you could increase this limit, it will be nice !
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in client/modules/IDE/actions/uploader.js at the 80KB limit mentioned in the issue. Reproduce the upload with the referenced jszip.min.js file, then verify that the chosen larger limit allows the file to upload and display correctly without the reported CORS behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100