Skip to content

Fetch TinyTeX URLs dynamically from GitHub releases API - #7

Merged
Francy2009 merged 1 commit into
mainfrom
claude/tinytex-install-error-y6siar
Aug 10, 2026
Merged

Fetch TinyTeX URLs dynamically from GitHub releases API#7
Francy2009 merged 1 commit into
mainfrom
claude/tinytex-install-error-y6siar

Conversation

@Francy2009

Copy link
Copy Markdown
Owner

Summary

Refactored TinyTeX download mechanism to dynamically fetch available releases from the GitHub API instead of relying on hardcoded URLs. This makes the installation more resilient to naming scheme changes and new release formats.

Key Changes

  • Dynamic release discovery: Added urlDalleRelease() function that queries the GitHub API (/repos/rstudio/tinytex-releases/releases) to discover available TinyTeX archives
  • Smart variant selection: Implemented ordineVarianteTinyTeX() to intelligently select the "TinyTeX-1" variant (medium installation) from available releases, handling both versioned and unversioned filenames
  • Fallback mechanism: Renamed TINYTEX_URL to TINYTEX_URL_RISERVA and repositioned it as a last-resort fallback when the API is unreachable
  • Archive validation: Added file size check (minimum 1 MB) to detect when a download succeeded but returned an error page instead of the actual archive
  • Improved error handling: Enhanced error messages with actionable guidance about TEXFORGE_TINYTEX_URL environment variable
  • Platform-agnostic naming: Changed archive naming from URL-derived to platform-based (TinyTeX.zip, TinyTeX.tgz, TinyTeX.tar.gz) to handle varying URL schemes
  • New utility function: Added scaricaTesto() to fetch small JSON resources with redirect support and proper GitHub API headers

Implementation Details

  • The new risolviCandidati() function orchestrates the resolution strategy: environment variable → API results → fallback URLs
  • API requests include proper User-Agent and Accept headers for GitHub API compatibility
  • Redirect handling with a 5-attempt limit prevents infinite loops
  • Failed downloads are cleaned up before trying the next source
  • Maintains backward compatibility with TEXFORGE_TINYTEX_URL override

https://claude.ai/code/session_017W5az9Prp2cseUs6W4zi2N

Gli URL di TinyTeX erano scritti a mano (TinyTeX-1.zip sui tag "daily" e
"latest", più il redirect di yihui.org). Le release di tinytex-releases ora
allegano archivi con la versione nel nome (TinyTeX-1-v2025.08.zip), quindi
tutte e tre le fonti rispondevano 404 e l'installazione falliva: senza
distribuzione, anche la pagina Pacchetti restava inutilizzabile.

Ora gli indirizzi si ricavano dall'API delle release: fra gli allegati con
l'estensione della piattaforma si preferisce TinyTeX-1, poi le altre
varianti, scorrendo le release dalla più recente. Gli URL fissi restano solo
come riserva se l'API non è raggiungibile.

In più: il nome dell'archivio temporaneo segue la piattaforma e non l'URL
(è quello che decide come estrarlo), gli archivi sospetti sotto 1 MB sono
scartati come fonti non valide, e il messaggio d'errore finale spiega come
usare TEXFORGE_TINYTEX_URL.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017W5az9Prp2cseUs6W4zi2N
@Francy2009
Francy2009 merged commit 7bee5b6 into main Aug 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants