yourhead / s3

public info about s3
8 stars 7 forks source link

Paths to Resources incorrect inside page assets #592

Closed joeworkman closed 7 years ago

joeworkman commented 8 years ago

When I try to insert the path to a Resource (via the link tool) inside a CSS or JS file. The resulting path assumes that the file is getting referenced from the HTML file. It needs an extra ../ when using relative to page paths.

I think that this is a limitation with the RW Resources API. But I figured that I would file this bug for completeness.

yourhead commented 7 years ago

I'll need more specific information about which path variable you're using, what mode you're using it in, and what file you're using it in. All of these things affect the "../" part of the path.

I don't doubt that the bug exists -- but there are, quite literally, thousands of path combinations and there's simply no way for me to guess where this bug might be.

There have also been several path bugs fixed since this bug was posted -- so there is a healthy chance that this was already fixed.

An easy way to document a path bug is to use the Paths demo stack (https://github.com/yourhead/PathsTestStack) and modifying it to display the error in question.

joeworkman commented 7 years ago

This has nothing to do with any of the Stacks macros. If you have a link setting. Then the user chooses an RW resource. I then want to get the path to that resource so I use %id=myLink -href%. The path to the resource is correct if I were to place it inside an HTML file. However, if I use that inside a PHP template, the path is the same as if it were in an HTML template. This is because the PHP template is not stored in the same folder as the HTML.

yourhead commented 7 years ago

I see what you're getting at. You'd like to get a php-friendly path from the user's link choice.

I think this is probably feasible -- but comes with a ton of caveats:

i think in this case, there are enough caveats that it seems like this is just best handled from within php.

php has the same info available and can strip the correct bits to create a local path in almost exactly the same way that stacks would -- but it also has knowledge of the rest of the file system which gives it a significant advantage.

yourhead commented 7 years ago

unless this is shown to be infeasible within php for some reason, i think it's time to close