Skip to content

same name files in different folders doesn't work #1217

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

Closed
kazuhikoarase opened this issue Nov 26, 2019 · 2 comments · Fixed by #1475
Closed

same name files in different folders doesn't work #1217

kazuhikoarase opened this issue Nov 26, 2019 · 2 comments · Fixed by #1475

Comments

@kazuhikoarase
Copy link

Nature of issue?

  • Found a bug

Details about the bug:

  • Web browser and version: Chrome
  • Operating System: Windows
  • Steps to reproduce this bug:

I create three assets as follows.

data.json
assets/data.json
assets/data2.json

https://editor.p5js.org/kazuhikoarase/sketches/dC8lEP02D

Then use loadStrings function and attempt to load them.
Without second assets 'assets/data.json', it works. But with it, causes error.
I saw that second assets's path(encoded) starts with 'assets/'.
Isn't is something related with the error?

Thank you.

file#0 = blob:https://editor.p5js.org/61b30737-c1cc-4d6c-a210-c0de8fba7567 
file#1 = assets/blob:https://editor.p5js.org/61b30737-c1cc-4d6c-a210-c0de8fba7567 
file#2 = blob:https://editor.p5js.org/4ed556dc-2c7d-4f04-a746-84edbf1f22c6 
> p5.js says: It looks like there was a problem loading your text file. Try checking if the file path [Error: [object ReadableStream]] is correct, or running a local server.[https://github.com/processing/p5.js/wiki/Local-server]
@catarak
Copy link
Member

catarak commented Dec 5, 2019

Thanks for reporting! This is possibly related to #1205. I noticed that if you comment out the first line too, it still doesn't work.

@akshay-99
Copy link
Member

akshay-99 commented Feb 23, 2020

Hey @catarak I would love to work on this.

So the problem lies with the regex and replace() in resolveJSLinksInString in PreviewFrames.jsx. If there are two files with the same name, even with different paths, the first pass would replace both their names in the original code with the blob url of the first file.

I will fix this and create a PR soon.
Maybe I can fix #1205 too.

akshay-99 added a commit to akshay-99/p5.js-web-editor that referenced this issue Feb 23, 2020
Fix the regex check so as to perform the
replace when the path matches exactly.
For e.g. A pass looking for 'data.json' won't
affect 'assets/data.json' or '/data.json'.
They will be handled separately in their own passes.
@dhoizner dhoizner mentioned this issue Jun 25, 2020
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants