web-monitoring-ui icon indicating copy to clipboard operation
web-monitoring-ui copied to clipboard

Handle malformed redirect data in some versions

Open Mr0grog opened this issue 2 months ago • 0 comments

I ran across an old Versionista version today that has malformed redirect data (https://api.monitoring.envirodatagov.org/api/v0/versions/69ff9ffe-0482-49fc-b5f6-f3d3b9906dcd), it turns out that breaks the UI. See this comparison view for an example: https://monitoring.envirodatagov.org/page/447f59e4-1bf8-4c63-918e-43030acc59b6/69ff9ffe-0482-49fc-b5f6-f3d3b9906dcd..cd686ddd-05ba-4b94-ac96-b878e5e65383

The problem here is that this version has bad data in its redirect history:

{
    "uuid": "69ff9ffe-0482-49fc-b5f6-f3d3b9906dcd",
    "source_metadata": {
        "redirects": [
            "2016-01-01T00:00:00.000Z"
        ],
        // ...
    },
    // ...
}

The PageUrlDetails component sees that there are redirects and attempts to show a list of them with UrlHistoryList, which errors when it calls parseUrlForDiff() on the invalid URL.

We should probably validate that the history is actually a list of URLs first and either only show it if all the entries are valid or just filter out the invalid entries. Either is probably OK.

Mr0grog avatar Sep 27 '25 00:09 Mr0grog