mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
aider: Fix the issue with forming the raw URL for a non-raw GitHub gist by including the username in the URL.
# Aider chat conversation:
USER: if the mdurl is a non-raw github gist like this `https://gist.github.com/paul-gauthier/2a4ac695b77f6374c923b0b165a6872b` pull out the h
ash and turn into a raw url like this: `4fd2ac290d
64100e51206fb6874e9ac20644fcd`. Right now it's not including the username (paul-gauthier) portion in the raw url
ASSISTANT: To fix this issue, we need to modify the JavaScript code in the `share/index.md` file. The current code is not correctly forming the raw URL for a non-raw GitHub gist. It's missing the username in the raw URL.
Here is the step-by-step plan:
1. Modify the regular expression to capture the username and the gist hash.
2. Update the raw URL formation to include the captured username.
Here is the *edit block* for the change:
```markdown
share/index.md
<<<<<<< ORIGINAL
var gistRegex = /^https:\/\/gist\.github\.com\/[^\/]+\/([a-f0-9]+)$/;
var match = gistRegex.exec(conv);
if (match) {
// If it is, convert it into a raw URL
conv = 'https://gist.githubusercontent.com/' + match[1] + '/raw';
}
=======
var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/;
var match = gistRegex.exec(conv);
if (match) {
// If it is, convert it into a raw URL
conv = 'https://gist.githubusercontent.com/' + match[1] + '/' + match[2] + '/raw';
}
>>>>>>> UPDATED
```
This change will correctly form the raw URL for a non-raw GitHub gist by including the username in the URL.
This commit is contained in:
parent
8e1a1f5886
commit
0f682570a4
1 changed files with 2 additions and 2 deletions
|
@ -16,11 +16,11 @@ window.onload = function() {
|
|||
return;
|
||||
}
|
||||
// Check if the URL is a non-raw GitHub gist
|
||||
var gistRegex = /^https:\/\/gist\.github\.com\/[^\/]+\/([a-f0-9]+)$/;
|
||||
var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/;
|
||||
var match = gistRegex.exec(conv);
|
||||
if (match) {
|
||||
// If it is, convert it into a raw URL
|
||||
conv = 'https://gist.githubusercontent.com/' + match[1] + '/raw';
|
||||
conv = 'https://gist.githubusercontent.com/' + match[1] + '/' + match[2] + '/raw';
|
||||
}
|
||||
fetch(conv)
|
||||
.then(response => response.text())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue