# Possible Pinegrow's internal server bug?

**URL:** <https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430>\
**Category:** Bug Reports\
**Created:** [August 9, 2020, 8:10am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430 "2020-08-09T08:10:41Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 9, 2020, 8:10am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/1 "2020-08-09T08:10:41Z")

</div>

Hi all,

I know PG’s internal server is a mystery one serving pure html/css/js…

This has been hitting me for a long time, really frustrating… but would like to understand if it’s PG’s fault or not. In my code snippet (included at end):

- both img tags gets literally the same src starting with a / (slash).

- while PG shows one img correctly, It doesn’t pickup the other image  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/6/6995bf06522a7468615fd7c5be4e783ab7501e2b.png)

- when I open the same page in vscode live server, both images are displayed correctly  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/2/213950496648626ad7a1656ef47aa472904a8861.png)

WHY this anomoly?

```auto
<!DOCTYPE html>
<html lang="en">

<head>
  <title>Is this a bug?</title>
</head>

<body>
  <img id="in-html" src="/image.jpeg" />
  <img id="via-js" src="#" />

  <script type="text/javascript">
    document.getElementById('via-js').src = '/image.jpeg'
  </script>

</body>

</html>

```

Related stackoverflow discussion here - [What does “./” (dot slash) refer to in terms of an HTML file path location?](https://stackoverflow.com/questions/7591240/what-does-dot-slash-refer-to-in-terms-of-an-html-file-path-location)

---

<div class="post-metadata">

**Author:** ![droidgoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/droidgoo/32/2209_2.png) [@droidgoo](https://forum.pinegrow.com/u/droidgoo)\
**Post date:** [August 9, 2020, 3:10pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/2 "2020-08-09T15:10:58Z")

</div>

is PG interpreting the # before the js defines it?

what happens if you move the js to above the img?

or am i being too procedural in my thinking…

what happens if you leave the 2nd image src defined as NULL?

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 11, 2020, 10:59pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/3 "2020-08-11T22:59:36Z")

</div>

Tried a lot of combinations @droidgoo, no luck… Something is fundamentally wrong… It even doubt if PG has an internal server at all, looks like it’s just opening local file for edit and renders it, may be hence we see the local file opened when we try to preview any page in the browser.

---

<div class="post-metadata">

**Author:** ![Pinegrow\_User](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/pinegrow_user/32/4919_2.png) [@Pinegrow\_User](https://forum.pinegrow.com/u/Pinegrow_User)\
**Post date:** [August 12, 2020, 1:28am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/4 "2020-08-12T01:28:44Z")

</div>

Try using `./` and **re / enable** Javascript (see below) then both should preview correctly in app.

> Pinegrow Preference Settings Enable Javascript
> 
> ![Pinegrow-Pref-Settings-Enable-Javascript](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/8/889861b001618277a8c4b94479275b521c8ecf5c.png)
> 
> Pinegrow Toolbar Toggle Javascript
> 
> ![Pinegrow-Toolbar-Toggle-Javascript](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/8/89e76300fef19bda113a0b8679c7ec178ea7e789.png)

Perhaps within the app when you use just `/` via Javascript it takes you upwards into the internals of Pinegrow itself, someone can correct me on that. But if your image is residing directly beside your html then `./` should work in both instances correctly as long as **JS is enabled** as seen above. It should then correctly preview in app along with when viewed directly in a browser locally.

* * *

I’m not sure where in the Pinegrow Documentation is a good singular reference regarding things related to JS. The below holding page `"docs/working-with/javascript/"` would definitely be a good spot for general related javascript things for the app. 😉

[https://pinegrow.com/docs/working-with/javascript/](https://pinegrow.com/docs/working-with/javascript/)

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 12, 2020, 1:38am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/5 "2020-08-12T01:38:47Z")

</div>

Thanks @Pinegrow_User… The ./ does work, but I’m after why / doesn’t work as it’s a valid one, especially when the / works in html and not when rendered via javascript (only in PG, other servers renders this fine).

Long story short, I have webpack on my “real” app, that outputs:

- css & js minified links starting with a / (slash)
- dynamic elements whose href & src also starts with a / (slash)

The first one, where I want to convert / to ./, I can use pinegrow’s below fix link, which does fix it and the css & js files successfully load.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/a/a702450709fbd6622d2e8c9c5808ea0346e03a99.png)

The second one, I can’t fix it in PG as they are dynamic elements.

To summarize, / should work as it’s still valid, PG is anyway rendering it fine for inline html, while it doesn’t when generated by js (while other other servers works fine). Hence, this bug report.

Can one of the pinegrow team help here please, @Emmanuel

---

<div class="post-metadata">

**Author:** ![Pinegrow\_User](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/pinegrow_user/32/4919_2.png) [@Pinegrow\_User](https://forum.pinegrow.com/u/Pinegrow_User)\
**Post date:** [August 12, 2020, 1:59am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/6 "2020-08-12T01:59:42Z")

</div>

Yes I agree, using `/` does not work for me either, thats why I wondered aloud if using it via JS is going a leverl up into Pinegrow itself. Its rather odd I will agree as each are valid.

I saw [your other post](https://forum.pinegrow.com/t/vuejs-support-for-pinegrow/2028/10) about JS Frameworks in the Vue thread. Hopefully staff will respond to both.

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 15, 2020, 2:00pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/7 "2020-08-15T14:00:20Z")

</div>

@RobM, any luck with this one? Would be great to get some clarity on if this is in fact a bug or not? Thank you!

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [August 15, 2020, 4:17pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/8 "2020-08-15T16:17:12Z")

</div>

@TechAkayy  
Well, `/` and `./` are actually interpreted differently. The first, a forward slash by itself actually refers to the root, while adding a dot before it refers to the current directory of the file it is in.  
To illustrate-  
With the following HTML:

```auto
<img src="/photo.jpeg" alt="Avatar" style="width:100%">

```

For output I get:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/f/f3b5a70f9ee4040fff92acf6f69c00b97683b670.png)  
For:

```auto
<img src="./photo.jpeg" alt="Avatar" style="width:100%">

```

I get:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/d/df69c0013b519c317e49e0fc65c4c017606427da.png)

With regards to the server - When you are adding the `src` by JS it doesn’t have the correct reference for the base file, so when it encounters the naked slash it interprets in as the root of your server without any of the intervening folders

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/2/244ef820f2f7e334048bbbf2168ae03106fad2e8.png)  
I’m not what the right behavior should be for PG. I can see an instance where you have a nested component and in the production environment you want to access root, so I’m thinking that the “fix links” shouldn’t “repair” this. I’m wondering if having the preview interpret the naked slash differently should be the behavior. So in this example, the PG server should interpret it as:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/bc47f285fd68327c9823dd625c085e8e2de3950a.png)  
prepended to ‘photo.jpg’. This is essentially what the server will do when it sees `./` when it outputs to the preview browser.

I’ll ask about the “correct” behavior"

---

<div class="post-metadata">

**Author:** ![Pinegrow\_User](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/pinegrow_user/32/4919_2.png) [@Pinegrow\_User](https://forum.pinegrow.com/u/Pinegrow_User)\
**Post date:** [August 16, 2020, 4:50pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/9 "2020-08-16T16:50:32Z")

</div>

> [@RobM](#):
>
> ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/bc47f285fd68327c9823dd625c085e8e2de3950a.png)

@RobM Are you by chance making a Lottie plugin (regarding this recent Lottie [thread](https://forum.pinegrow.com/t/control-lottie-animation-playback-with-anmation-plugin/4438)) ?

---

<div class="post-metadata">

**Author:** ![droidgoo](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/droidgoo/32/2209_2.png) [@droidgoo](https://forum.pinegrow.com/u/droidgoo)\
**Post date:** [August 16, 2020, 5:17pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/10 "2020-08-16T17:17:14Z")

</div>

D-oh!

i knew showing that file structure sting was going to come back on him 🙂

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [August 16, 2020, 7:32pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/11 "2020-08-16T19:32:37Z")

</div>

😉 Why do you ask? 🤣

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [August 17, 2020, 2:13am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/12 "2020-08-17T02:13:20Z")

</div>

@TechAkayy the page base href in PG is not the same as outside of PG, due to the way of how the internal web server is addressed. PG does some URL mapping behind the scenes for static HTML. That’s why the HTML example works. But it can’t do anything for dynamic JS code.

One workaround is to use relative urls like `image.jpeg` or `../images/image.jpeg` but of course that doesn’t work if the same code is run on pages at different levels of the folder structure.

---

<div class="post-metadata">

**Author:** ![Eladb](https://avatars.discourse-cdn.com/v4/letter/e/f6c823/32.png) [@Eladb](https://forum.pinegrow.com/u/Eladb)\
**Post date:** [August 17, 2020, 10:02pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/13 "2020-08-17T22:02:40Z")

</div>

Just found it out and thought it would be useful (myabe cause you probably know this already):

> **[Lottie Player - Interactivity Guide](https://lottiefiles.com/interactivity?url=https:%2F%2Fassets5.lottiefiles.com%2Fpackages%2Flf20_Loi97B.json)**
>
> This is a quick demo for using the Lottie interactivity library with the Lottie Web Player component and the Lottie Player to add interactivity to your applications

theres an opensource plugin for controling lottie with this script, it scrubs through the frames of the file by scroll or other events.

if you want to try it out you will need to include the main lottiefiles script.

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [August 18, 2020, 9:23am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/14 "2020-08-18T09:23:46Z")

</div>

Thanks, I’ve already had been working with this library for awhile.

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 21, 2020, 12:53am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/15 "2020-08-21T00:53:15Z")

</div>

Hi @RobM, thanks very much for taking the time to explain, clearly PG using my file system as base URL for absolute paths doesn’t make sense at all.

Web servers usually have a baseURL, or at least consider the current location of the index.html file as baseURL. I have already opened my project in PG, not my whole file system. Definitely, there is opportunity for improvement here (it’s really not an improvement, I see it as a fundamental).

Thanks again!

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 21, 2020, 12:55am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/16 "2020-08-21T00:55:39Z")

</div>

Thanks @matjaz for taking the time to explain.

I have sent a follow-up on this issue via email to Pinegrow support with more details and attachments, would appreciate you having a look at it. Cheers!

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [August 23, 2020, 1:26am UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/17 "2020-08-23T01:26:00Z")

</div>

Thanks @TechAkayy, I did some work on that, will reply soon.

Local projects can now be served from the internal server root. That would solve these issues.

The feature will be out soon, we are testing it at the moment.

 ![rooturls](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/e/e30dc649fece014d0711689feac8a2bf28060d59.jpeg)

---

<div class="post-metadata">

**Author:** ![TechAkayy](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@TechAkayy](https://forum.pinegrow.com/u/TechAkayy)\
**Post date:** [August 23, 2020, 12:00pm UTC](https://forum.pinegrow.com/t/possible-pinegrows-internal-server-bug/4430/18 "2020-08-23T12:00:37Z")

</div>

Thanks bunch @matjaz for prioritising it, much appreciated 🙂
