(name)
| 353 | } |
| 354 | |
| 355 | function sanitizeFilename(name) { |
| 356 | // Strip extension, collapse whitespace, cap at 120 chars — mirrors the |
| 357 | // backend _sanitize_title() so title and sourceUrl match on both sides. |
| 358 | return name |
| 359 | .replace(/\.[^.]+$/, "") |
| 360 | .replace(/\s+/g, " ") |
| 361 | .trim() |
| 362 | .slice(0, 120); |
| 363 | } |
| 364 | |
| 365 | // Programmatic URL import — re-uses the full studio/SSE pipeline (same as the |
| 366 | // import form's URL path). Used by the library "Sync again" auto-restore to |