Skip to content

Training slides: Remove nocache directive and sanitize custom URLs#1193

Merged
nrichers merged 2 commits intomainfrom
nocache-hotfix-for-main
Mar 3, 2026
Merged

Training slides: Remove nocache directive and sanitize custom URLs#1193
nrichers merged 2 commits intomainfrom
nocache-hotfix-for-main

Conversation

@nrichers
Copy link
Collaborator

@nrichers nrichers commented Feb 28, 2026

Pull Request Description

What and why?

Applies fixes from #1192 (merged to prod) to main, plus an additional improvement:

  1. Remove nocache directive — Replaces the nocache query parameter approach with location.reload(true) to fix odd behavior observed in the training login slides.
  2. Strip trailing slashes — Sanitizes custom URL input to prevent issues with URL replacement when users enter URLs with trailing slashes with can lead to iframed 404s.

How to test

  1. In the preview, open a training module with the "Before you begin" login tab.
  2. Click "Custom URL" and enter a URL with trailing slashes (example: https://app.dev.vm.validmind.ai/).
  3. Click "Save & Reload" and verify the trailing slash is stripped.
  4. Check that custom URLs get rendered correctly on some iframed pages.
Before After
URLs can end in /:
Capto_ 2026-03-02_02-21-04_pm
Which can lead to 404s due to a double //:
Capto_ 2026-03-02_02-21-45_pm
URLs are sanitized to strip the /:
Capto_ 2026-03-02_02-28-47_pm
Which renders as expected:
Capto_ 2026-03-02_02-22-44_pm

What needs special review?

N/A — straightforward changes already validated in prod.

Dependencies, breaking changes, and deployment notes

None.

Release notes

N/A — internal fix.

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

Use location.reload(true) instead of appending a nocache query
parameter to fix odd behavior observed in production.

Related: #1192
@nrichers nrichers added the internal Not to be externalized in the release notes label Feb 28, 2026
Sanitize URLs in setCustomUrl to prevent issues with URL replacement.
@nrichers nrichers changed the title Remove nocache directive from training login slides Training slides: Remove nocache directive and sanitize custom URLs Feb 28, 2026
@github-actions
Copy link
Contributor

PR Summary

This PR introduces two key enhancements:

  1. In the vmurl-settings.js file, the function that saves a custom URL to localStorage has been updated to trim any trailing slashes. This ensures that URLs are stored in a consistent format by removing extra trailing slashes using a regex.

  2. In the _log-in-with-jupyterhub.qmd and _log-in.qmd files, the refresh button behavior has been modified. Instead of constructing a new URL with a cache-busting query parameter, the button now triggers a full page reload using location.reload(true). This change simplifies the refresh mechanism and ensures that the latest content is fetched from the server.

Test Suggestions

  • Verify that when a URL with trailing slashes is saved, the stored value in localStorage does not include the trailing slashes.
  • Test the refresh button on both login pages to confirm that clicking it performs a full page reload and properly fetches the latest content.
  • Check edge cases such as providing empty or whitespace-only inputs to ensure the URL is removed from localStorage as expected.

@github-actions
Copy link
Contributor

Lighthouse check results

⚠️ WARN: Average accessibility score is 0.87 (required: >0.9) — Check the workflow run

Show Lighthouse scores

Folder depth level checked: 0

Commit SHA: 7d6a626

Modify the workflow to check a different depth:

  • 0: Top-level navigation only — /index.html, /guide/guides.html, ...
  • 1: All first-level subdirectories — /guide/.html, /developer/.html, ...
  • 2: All second-level subdirectories — /guide/attestation/*.html, ...
Page Accessibility Performance Best Practices SEO
/developer/validmind-library.html 0.85 0.65 1.00 0.82
/get-started/get-started.html 0.85 0.74 1.00 0.73
/guide/guides.html 0.85 0.69 1.00 0.82
/index.html 0.93 0.69 1.00 0.82
/releases/all-releases.html 0.86 0.69 1.00 0.73
/support/support.html 0.91 0.68 1.00 0.82
/training/training.html 0.85 0.69 0.96 0.73

@github-actions
Copy link
Contributor

Validate docs site

✓ INFO: A live preview of the docs site is available — Open the preview

@nrichers nrichers requested a review from validbeck March 2, 2026 22:34
Copy link
Collaborator

@validbeck validbeck left a comment

Choose a reason for hiding this comment

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

This seems to work as expected, as far as I can tell.

@nrichers nrichers merged commit 86f1c52 into main Mar 3, 2026
11 of 12 checks passed
@nrichers nrichers deleted the nocache-hotfix-for-main branch March 3, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Not to be externalized in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants