riasvdv / statamic-redirect

Redirect allows you to redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
https://statamic.com/addons/rias/redirect
19 stars 21 forks source link

Error ParseException: Unable to parse yaml #97

Closed onelovefame closed 2 years ago

onelovefame commented 2 years ago

Hello,

sometimes we get a 500 on the redirect page in the control panel (/cp//redirect/dashboard) due to yaml parsing errors.

It seems that sometimes the user agent string in the _hits files causes problems. Here is an example of the yaml entry causing problems:

`

timestamp: 1663207255 
   data: 
      userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36'
  ip: 20.224.153.230
  referer: null 
.108 Safari/537.36'
  ip: 51.142.142.23
  referer: null

` Here is the entire yaml file as txt: d6be4b6b-e3a1-43b4-a850-7ba8163a3dac_hits.txt

When I look at the file with an editor, I see strange characters: MicrosoftTeams-image

At the moment we have created a script to parse the yaml files and are manually fixing the problems in the files. Any idea where this could happen? - I'd be happy to take a deeper look if needed.

riasvdv commented 2 years ago

Hi, which version of Redirect are you using? The newest version doesn't use yaml anymore for storing the errors & hits but sqlite instead.

I've changed this mostly because of issues like this.

onelovefame commented 2 years ago

We are currently using version 1.0.3. I will then update to version 2.* and assume that this will solve the problem.

If the problem persists, I would reopen the issue - thank you.