hicetnunc
hicetnunc copied to clipboard
Interactive OBJKTs with subfolders cannot be previewed
It is stated in docs that "Subfolders are ok." However when I upload and preview interactive OBJKT with subfolders, I get 404 errors for resources in subfolders.
Steps to reproduce Steps to reproduce the behavior:
- Upload zip with resources in subfolders.
- Preview it.
Expected behavior All resources are accessible.
It is stated in docs that "Subfolders are ok."
Can you link me to that information? I'm pretty sure that's incorrect unless something changed and I'm not aware..
Link to wiki page where it is stated that "Subfolders are OK": https://github.com/hicetnunc2000/hicetnunc/wiki/Interactive-OBJKTs#folder-structure
And yes I managed to make my interactive HTML+JS OBJKT to work after flattening it to root folder (this required refactoring of code). Placing 20+ resources in root which looks a bit ugly TBH.
@keaukraine subfolders should indeed work. Can you provide a sample zip file so I can test? Thanks
@keaukraine Would you mind testing with this zip? nested-folders.zip
Perhaps you are using absolute paths in your code? I realized it wasn't clear in the docs that you need to use relative paths – have updated the guide.
I was trying to mint an interactive OBJKT with subfolders, and indeed, I had trouble getting it to work. Then when I flattened it as @keaukraine suggests, it started to work! My file paths were all relative; the only difference is that I moved everything outside the nested folder.
But @pichiste your test zip works for me too, so I'm not sure what the problem is.
Hey @damondpham, could you share a sample zip file that exhibits the error with the subfolders? I'm unable to reproduce the problem so it would be very helpful. Thanks
Sure, here is an example. The html file should show a white square against a blue background, but the white square is absent in the H=N preview. HEN_bug.zip
If I replace the div having the image background with a regular tag that also doesn't work. Here the white square becomes a 404 icon for me.
HEN_bug2.zip
@damondpham Thanks for posting the test file – strangely, if I unzip, then re-zip your test file, it works for me (I'm on mac). Can you try with this one?
Are you on Windows by chance? There was a case before where a similar issue occurred, where a zip created on Windows didn't work, but did work if unzipped/re-zipped on a mac.
Your re-zipped file works for me. Yes, I'm on Windows! So that seems to be the issue.
Ok, good to know. I will need look further into this when I can get access to a windows machine to test on. Will report back here with findings. Thanks for helping track this down!
I encountered the same issue on MacOS and discovered that it was caused by how I was creating the zip archive.
My directory structure is:
➜ cd project
➜ tree .
.
├── dist
│ └── index.js
├── index.css
└── index.html
And index.html references dist/index.js through the following script tag <script type="module" src="dist/index.js"></script>
.
From within the project
directory, if I create the zip archive with zip -r project.zip .
, I get the 404 error.
From within the project
directory, if I create the zip archive with MacOS Archive Utility via Finder, or with the following command ditto -c -k --sequesterRsrc --keepParent . project.zip
, everything works as expected.