Fixes path, image, and bibliography issues #7
@@ -105,12 +105,13 @@ export class EmbedProcessor {
|
||||
|
||||
const outputPath = path.join(tempDir, finalFileName);
|
||||
|
|
||||
|
||||
// Select appropriate protocol
|
||||
const protocol = imageUrl.startsWith('https') ? https : http;
|
||||
// Select appropriate protocol based on parsed URL (handles case-insensitive schemes)
|
||||
const protocol = urlObj.protocol === 'https:' ? https : http;
|
||||
|
||||
console.log(`Export: Downloading remote image: ${imageUrl}`);
|
||||
|
||||
const request = protocol.get(imageUrl, (response) => {
|
||||
// Use parsed URL object for the request to ensure correct protocol handling
|
||||
const request = protocol.get(urlObj, (response) => {
|
||||
// Handle redirects
|
||||
if (response.statusCode === 301 || response.statusCode === 302) {
|
||||
const redirectUrl = response.headers.location;
|
||||
|
||||
Reference in new issue
Block a user
⚠️ Potential issue | 🟠 Major
Preserve original image extensions instead of forcing
.png.When a remote file ends with something like
.svg, we append.pngwithout converting the contents. That leaves us with an SVG payload masquerading as PNG, so Typst/Pandoc will fail to decode the asset. Please keep the on-disk extension if one is present (at least include.svg,.ico, etc. invalidExtensions, or only fall back to.pngwhen the URL truly lacks an extension). Based on learnings🤖 Prompt for AI Agents
✅ Addressed in commits
7ac9e1fto4eb52d1