Update script.js

This commit is contained in:
ADARSH 2025-07-05 21:59:39 +05:30 committed by GitHub
parent 08b8930dbc
commit 1312726769
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -504,16 +504,16 @@ class PromptArsenal {
.replace(/\s+/g, '_') // Replace spaces with underscores
.replace(/_+/g, '_') // Replace multiple underscores with single
.replace('.md', '.txt');
console.log('Fetching from:', `./content/${safePath}`);
const response = await fetch(`./content/${safePath}`);
console.log('Fetching from:', `./${safePath}`);
const response = await fetch(`./${safePath}`);
if (response.ok) {
content = await response.text();
console.log('File loaded successfully:', filePath);
this.fileContents.set(filePath, content);
} else {
console.error('Error loading file:', response.status, 'Path:', `./content/${safePath}`);
content = `Error loading file: ${response.status}\nTried to load: ./content/${safePath}`;
console.error('Error loading file:', response.status, 'Path:', `./${safePath}`);
content = `Error loading file: ${response.status}\nTried to load: ./${safePath}`;
this.showNotification(`Failed to load file: ${response.status}`, 'error');
}
} catch (error) {
@ -571,7 +571,7 @@ class PromptArsenal {
.replace(/_+/g, '_') // Replace multiple underscores with single
.replace('.md', '.txt');
console.log('Loading preview for:', filePath, 'Safe path:', safePath);
const response = await fetch(`./content/${safePath}`);
const response = await fetch(`./${safePath}`);
if (response.ok) {
content = await response.text();
this.fileContents.set(filePath, content);