Skip to content

Migrate APOD archive URLs to science.nasa.gov/apod with backward-compatible malformed URL normalization - #86

Draft
oliveratgithub with Copilot wants to merge 3 commits into
masterfrom
copilot/migration-update-apod-website-links
Draft

oliveratgithub with Copilot wants to merge 3 commits into
masterfrom
copilot/migration-update-apod-website-links

Conversation

Copilot AI commented Sep 3, 2026

Copy link
Copy Markdown

APOD content links are moving from apod.nasa.gov to science.nasa.gov/apod, and existing URL construction/normalization paths needed updating to avoid broken archive/image links during the migration window. This change updates the base source URL and keeps malformed API URL handling compatible with both old and new APOD host patterns.

  • Configuration

    • Updated NASA_APOD_SOURCE in .env.example to https://science.nasa.gov/apod/.
    • Existing APOD_SOURCE constant usage remains unchanged and now resolves to the new domain via env config.
  • Runtime APOD URL handling

    • Updated APOD malformed URL normalization in public/includes/apod.inc.php to accept both legacy and new APOD prefixes before collapsing to the underlying http... target URL.
    • This preserves behavior for legacy payloads while supporting migrated payloads.
  • Documentation/examples

    • Updated APOD URL examples in README.md and inline APOD response comments to the new domain.
$new_apod_img_small = str_replace(
    ['https://apod.nasa.gov/apod/http', 'https://science.nasa.gov/apod/http'],
    'http',
    $apod_data['url']
);

Co-authored-by: oliveratgithub <280207+oliveratgithub@users.noreply.github.com>
Copilot AI changed the title [WIP] Update APOD website links for migration Migrate APOD archive URLs to science.nasa.gov/apod with backward-compatible malformed URL normalization Sep 3, 2026
Copilot AI requested a review from oliveratgithub September 3, 2026 06:03
Comment thread public/includes/apod.inc.php Outdated
Comment on lines +92 to +93
$new_apod_img_small = str_replace(['https://apod.nasa.gov/apod/http', 'https://science.nasa.gov/apod/http'], 'http', $apod_data['url']); // with fix for malformed url (APOD API issue)
$new_apod_img_large = str_replace(['https://apod.nasa.gov/apod/http', 'https://science.nasa.gov/apod/http'], 'http', $apod_data['hdurl']); // with fix for malformed url (APOD API issue)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Use The dotENV VAR for the partial part, instead of continuing with a hardcoded full string.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in 981d2be: replaced the hardcoded new-domain prefix in the malformed APOD URL normalization with an APOD_SOURCE-derived prefix (APOD_SOURCE . 'http'), while keeping legacy apod.nasa.gov compatibility.

Co-authored-by: oliveratgithub <280207+oliveratgithub@users.noreply.github.com>
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.

[Migration] Neue NASA APOD Website-Links

2 participants