Skip Navigation

[Bug] Downloading revisions not working

[Bug] Downloading revisions not working

I made a similar post about this one (https://lemmy.world/post/11134086) and it happened again, and hopefully the Dev can notice. (ping please)

Here's the error that Perchance throws when I try to download revisions from https://perchance.org/power-generator-manager-10k-milestone:

Uncaught URIError: URI malformed
at decodeURI (see image)

EDIT: After some later investigation, I've found out that this does NOT affect earlier revisions (see this comment: https://lemmy.world/comment/8770044)

@perchance

15
15 comments
  • @perchance I also tried with my other generators such as power-name and power-sentence, and it worked well. Also, anybody can test this by downloading revisions on some of the generators and see if the error also popped out.

    • Hmm I think this may have been caused by multiple concurrent save requests, which added multiple versions of the same "diff patches" to the revisions list, or put them out of order, or something. Not entirely sure. I did fix the "save traffic jam" problem a few weeks ago like I mentioned to you in another post, and I just added some server-side checks to make sure that a save request is rejected if there's already one in progress. Hopefully that fixed it, but it's possible that there's another issue.

      Unfortunately, regardless of this fix, your current revisions are corrupted (it's likely possible to fix with some manual work, but it'd not be easy). If it's particularly important then it is possible for you to access the raw diff data by opening the browser console and typing window.diffStuff.outputTemplatePatches but it'd require some expertise and probably an hour or two of work.

      Assuming the revisions of that generator aren't super important to you, the best way to "fix" it is to duplicate the generator, then delete the old one, and claim the old name with the new one. And please let me know if it happens again - that way I can look further into this, knowing that it's not due to concurrent save requests.

      Sorry about that!

      • Update regarding on the revisions: The bug seems to affect later revisions, and not the entire revision list. And here's what I've done so far.

        When trying to download some earlier revisions in power-generator-manager, I have to say that revisions only made after 12 January 2024, 23:31:11 UTC+7 (after index 863) are affected by this bug. I even ran this line of code in the console to get a decoded URI of the latest model patch:

        decodeURI(diffStuff._patchesToRevision(diffStuff.modelTextPatches, 1617))
        

        And that returned the exact same error, URI malformed. So that's a problem with the encoded text on each specific revision.

        But my investigation doesn't stop there. To see if there's a single character that triggers the entire URI corruption, I also compared those raw revision data of index 863 and 864, decoded manually, in a text comparison app, and I've finally found the culprit, in line 204:

        Revision Sat Jan 13 2024 13:09:52 GMT+0700 (GMT+07:00):

        <li><b>The generator manager is getting another big update!</b> ... Scroll down past the end of the announcement to see the full changelog of the update!</li>
        

        Revision Fri Jan 12 2024 23:31:11 GMT+0700 (GMT+07:00):

        <li><b>The generator manager is getting another big update!</b> ... Scroll down past20the announcement to see the full changelog of the%2!</li>
        

        And there it is, the %2 that triggered the URI malformed problem. There was apparently some sort of a glitch with the diffStuff._patchesToRevision() function when it tries to parse the raw patch data into a revision (that could be on the concurrent save requests you've mentioned).

        I then tried the same procedure in the latest revision of the hub page and found that the %2 character started spreading around the generator code multiple times. Not only that, but parts of the entire data are also scrambled pretty bad, too. (This doesn't happen on unaffected revisions!) So your statement on "your current revisions are corrupted" is kind of true.

        And now, every time I had to get a revision, I'd have to get the patch directly with that specific approach, manually decode it, transfer it into a notepad, and then saving it if I wanted to (unless there's a way to fix that URI corruption thing).

        And yes, I did check the outputTemplatePatches and everything in it is okay, no corruption whatsoever. Even to the latest one 🙂

      • Thanks for the explanation and the possible fix! That would've been sucked if my revisions are possibly messed up - especially if I had to download some just to revisit some of my older versions of that generator, especially the power-generator-manager one.

        I also want to note, for the new save, whenever the save button get stuck on the disabled "saving" state, I'd just reload the generator using the "reload" button (and maybe check in the DevTools network just to make sure) to ensure that the save process is fully done. (Might also create a separate post for this)

15 comments