Skip to content

Commit 7f99c62

Browse files
committed
fix: resolve Windows CI test failures for image downloader
Remove backslash check in generateSafeFilename to prevent false matches on Windows paths Use filepath.Join in test to ensure cross-platform path compatibility
1 parent cfd6bef commit 7f99c62

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/images.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (id *ImageDownloader) generateSafeFilename(imageURL string) (string, error)
286286
filename := filepath.Base(parsedURL.Path)
287287

288288
// If no valid filename, generate one from URL patterns
289-
if filename == "" || filename == "/" || filename == "." || filename == "\\" {
289+
if filename == "" || filename == "/" || filename == "." {
290290
filename = "" // Reset to force fallback logic
291291

292292
// Try to extract from the URL patterns

lib/images_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ func TestUpdateHTMLWithLocalPaths(t *testing.T) {
430430
<img src="https://example.com/image1.jpg" alt="Same image again">`
431431

432432
urlToLocalPath := map[string]string{
433-
"https://example.com/image1.jpg": "/output/images/post/image1.jpg",
434-
"https://example.com/image2.png": "/output/images/post/image2.png",
433+
"https://example.com/image1.jpg": filepath.Join("/output", "images", "post", "image1.jpg"),
434+
"https://example.com/image2.png": filepath.Join("/output", "images", "post", "image2.png"),
435435
}
436436

437437
updatedHTML := downloader.updateHTMLWithLocalPaths(originalHTML, urlToLocalPath)

0 commit comments

Comments
 (0)