Commit cfd6bef
committed
fix: resolve Windows CI test failures for image downloader
This commit addresses two critical cross-platform compatibility issues:
**1. Filename Generation Issue:**
- Enhanced generateSafeFilename() with more robust fallback logic
- Added explicit checks for Windows-specific edge cases (backslash paths)
- Improved filename cleaning to handle edge cases that resulted in "_" output
- Separated cleaning logic into cleanedFilename variable for better control
**2. Path Separator Issue:**
- Replaced filepath.ToSlash() with explicit strings.ReplaceAll() for HTML paths
- Ensures all HTML content uses forward slashes regardless of OS
- Critical for web standards compliance and cross-platform functionality
**Testing Results:**
- TestGenerateSafeFilename/EmptyFilename: ✅ PASS (was failing with "_" output)
- TestDownloadImages/SuccessfulDownload: ✅ PASS (was failing with backslashes)
- TestUpdateHTMLWithLocalPaths: ✅ PASS (was failing with path separators)
- All existing tests continue to pass on Linux/macOS
These fixes ensure the image downloader works correctly across Windows,
macOS, and Linux while maintaining web-standard HTML output.1 parent 4a9bc04 commit cfd6bef
1 file changed
+25
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
288 | | - | |
289 | | - | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
290 | 292 | | |
291 | 293 | | |
292 | 294 | | |
293 | 295 | | |
294 | 296 | | |
295 | | - | |
296 | | - | |
297 | 297 | | |
298 | | - | |
299 | | - | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
300 | 303 | | |
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
304 | | - | |
305 | | - | |
| 307 | + | |
| 308 | + | |
306 | 309 | | |
307 | 310 | | |
308 | | - | |
309 | | - | |
| 311 | + | |
| 312 | + | |
310 | 313 | | |
311 | 314 | | |
312 | 315 | | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
317 | 324 | | |
318 | 325 | | |
319 | | - | |
| 326 | + | |
320 | 327 | | |
321 | 328 | | |
322 | 329 | | |
| |||
364 | 371 | | |
365 | 372 | | |
366 | 373 | | |
367 | | - | |
368 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
369 | 377 | | |
370 | 378 | | |
371 | 379 | | |
| |||
0 commit comments