The Merry Christmas Article Was a Trainwreck

So, What Happened?

A derailed train in the snow with Christmas trees coming out of it
Trainwreck in the snow at Christmas

Oh man! So, when I shared the Merry Christmas article on FaceBook, I ran into a problem. When I clicked on the article my blog application launched, saying: 'No such article found'. This is totally unacceptable. I need to be able to share articles. After some digging, I found the culprit.

// php code
// this line, in the php, was the culprit. The query string was getting included in the blog slug.


So here we are taking the end of the URI and placing it in a variable, so that we can later look it up in the article database (of course, using regular expressions). The problem is, that FaceBook appends a query string on external links when it redirects. Because of this, the lookup was including the query string on the end of the article slug, which was returning no article. This is not acceptable. Not only should I be able to share my articles on FaceBook, my software should be robust enough to handle that case.

The Solution

The quick fix was to split the string on any '?' character, and take the first part. That got it going pretty quick, and I fixed the error in my application rendering pipeline, also.

This solution works, but php provides a server variable with the query string already omitted ($_SERVER['PATH_INFO']). That would be a better option, for sure.

Here is the Code:

// php code
// this is the first fix


A white question mark inside of a purple wreath laying on the ground
Now, there's a question!

Other Concerns

There were a couple of other concerns/bugs in it at launch... mostly having to do with math. I fixed most of them rather quickly. There was one having to do with the htaccess for the blog in my rendering pipeline, preventing the audio from being loaded. That is fixed now.

The last one is that the lights slightly deviate from the light stringer on different sized screens. This is happening because the light's positions are calculated propotionately, and the point that I used for the control point of the quadratic curve for the light stringer is calculated with a constant distance from the center. I may fix it, or I may just let it be 'artsy'. I wanna move on. Maybe next Christmas.

Related Articles

Valentine Love
The Launch of GG Hire Me
Link Indexer Complete
I Made a Git Hub!
Media Indexer Complete
2023 : A Web App Retrospective
Media Indexer Update
Happy New Year 2024