From c5d80e9f7acc55c175b23c705b275255df4f8804 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Mon, 7 Aug 2023 11:10:28 -0300 Subject: [PATCH] aider: Check if there is a mdurl param and skip the rest if not. # Aider chat conversation: USER: check to make sure there is a mdurl param, skip the rest if not ASSISTANT: To implement this change, we need to modify the `share/index.md` file. We will add a condition to check if the `mdurl` parameter exists before proceeding with the rest of the script. Here is the proposed change: ```markdown share/index.md <<<<<<< ORIGINAL window.onload = function() { var urlParams = new URLSearchParams(window.location.search); var conv = urlParams.get('mdurl'); fetch(conv) ======= window.onload = function() { var urlParams = new URLSearchParams(window.location.search); var conv = urlParams.get('mdurl'); if (!conv) { return; } fetch(conv) >>>>>>> UPDATED ``` This change checks if `conv` (which holds the value of the `mdurl` parameter) is not present. If it's not, the function returns immediately, skipping the rest of the script. --- share/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/share/index.md b/share/index.md index 06ce28155..4935e5296 100644 --- a/share/index.md +++ b/share/index.md @@ -12,6 +12,9 @@ created using aider. window.onload = function() { var urlParams = new URLSearchParams(window.location.search); var conv = urlParams.get('mdurl'); + if (!conv) { + return; + } fetch(conv) .then(response => response.text()) .then(markdown => {