Skip to content

Commit 07f481f

Browse files
peterbeheiskr
andauthored
Make sure all image asset lookups are case insensitive (#43107)
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
1 parent b8dfb50 commit 07f481f

File tree

16 files changed

+40
-7
lines changed

16 files changed

+40
-7
lines changed

content/billing/managing-billing-for-github-advanced-security/viewing-your-github-advanced-security-usage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ You can download the {% data variables.product.prodname_advanced_security %} lic
124124
{%- elsif ghes > 3.8 %}
125125
1. Under "{% data variables.product.prodname_GH_advanced_security %}," click {% octicon "download" aria-hidden="true" %} **CSV report** in the header of the "Committers" table.
126126

127-
![Screenshot of the {% data variables.product.prodname_GH_advanced_security %} licensing screen. The "CSV Report" button is highlighted with an orange outline.](/assets/images/enterprise/ghas/download-CSV-report-ghes-3.9.png)
127+
![Screenshot of the {% data variables.product.prodname_GH_advanced_security %} licensing screen. The "CSV Report" button is highlighted with an orange outline.](/assets/images/enterprise/ghas/download-csv-report-ghes-3.9.png)
128128

129129
{%- else %}
130130
1. Under "{% data variables.product.prodname_GH_advanced_security %}," {% octicon "download" aria-label="The download icon" %} in the header of the "Committers" table.

content/code-security/dependabot/dependabot-alerts/configuring-notifications-for-dependabot-alerts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ You can configure notification settings for yourself or your organization from t
5050

5151
{% ifversion update-notification-settings-22 %}
5252
![Screenshot of the notification options for {% data variables.product.prodname_dependabot_alerts %}. A dropdown menu, showing notification frequency options, is highlighted with an orange outline.](/assets/images/help/dependabot/dependabot-notification-frequency.png){% endif %}{% ifversion ghes > 3.7 or ghae > 3.7 %}
53-
![Screenshot of the notification options for {% data variables.product.prodname_dependabot_alerts %}.](/assets/images/help/enterprises/dependabot-alerts-options-no-UI.png){% endif %}
53+
![Screenshot of the notification options for {% data variables.product.prodname_dependabot_alerts %}.](/assets/images/help/enterprises/dependabot-alerts-options-no-ui.png){% endif %}
5454

5555
{% note %}
5656

content/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,6 @@ You can view all open alerts, and you can reopen alerts that have been previousl
235235
When a member of your organization {% ifversion not fpt %}or enterprise {% endif %}performs an action related to {% data variables.product.prodname_dependabot_alerts %}, you can review the actions in the audit log. For more information about accessing the log, see "[AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization#accessing-the-audit-log){% ifversion not fpt %}" and "[AUTOTITLE](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/accessing-the-audit-log-for-your-enterprise)."{% else %}."{% endif %}
236236
{% ifversion dependabot-alerts-audit-log %}
237237

238-
![Screenshot of the audit log showing Dependabot alerts.](/assets/images/help/dependabot/audit-log-UI-dependabot-alert.png){% endif %}
238+
![Screenshot of the audit log showing Dependabot alerts.](/assets/images/help/dependabot/audit-log-ui-dependabot-alert.png){% endif %}
239239

240240
Events in your audit log for {% data variables.product.prodname_dependabot_alerts %} include details such as who performed the action, what the action was, and when the action was performed. {% ifversion dependabot-alerts-audit-log %}The event also includes a link to the alert itself. When a member of your organization dismisses an alert, the event displays the dismissal reason and comment.{% endif %} For information on the {% data variables.product.prodname_dependabot_alerts %} actions, see the `repository_vulnerability_alert` category in "[AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization#repository_vulnerability_alert){% ifversion not fpt %}" and "[AUTOTITLE](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise#repository_vulnerability_alert)."{% else %}."{% endif %}

content/codespaces/prebuilding-your-codespaces/allowing-a-prebuild-to-access-other-repositories.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ You will need to create a new personal account and then use this account to crea
4949
{% ifversion ghec %}
5050
1. Click **Configure SSO** and authorize the token for use with SAML single sign-on (SSO), so that it can access repositories that are owned by organizations with SSO enabled. For more information, see "[AUTOTITLE](/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)."
5151

52-
![Screenshot of the "{% data variables.product.pat_v1_caps_plural %}" page. The "Configure SSO" button for a PAT is highlighted with a dark orange outline.](/assets/images/help/codespaces/configure-SSO-for-PAT.png)
52+
![Screenshot of the "{% data variables.product.pat_v1_caps_plural %}" page. The "Configure SSO" button for a PAT is highlighted with a dark orange outline.](/assets/images/help/codespaces/configure-sso-for-pat.png)
5353

5454
{% endif %}
5555
1. Copy the token string. You will assign this to a {% data variables.product.prodname_codespaces %} repository secret.

content/site-policy/privacy-policies/github-privacy-statement.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Below are translations of this document into other languages. In the event of an
337337

338338
### French
339339

340-
Cliquez ici pour obtenir la version française: [Déclaration de confidentialité de GitHub (PDF)](/assets/images/help/site-policy/github-privacy-statement(07.22.20)(FR).pdf)
340+
Cliquez ici pour obtenir la version française: [Déclaration de confidentialité de GitHub (PDF)](/assets/images/help/site-policy/github-privacy-statement(07.22.20)(fr).pdf)
341341

342342
### Other translations
343343

data/reusables/codespaces/usage-report-download.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
To see the costs for {% data variables.product.prodname_github_codespaces %} compute usage and storage, filter the report to show only rows that mention "Codespaces" in the `Product` column.
88

9-
![Screenshot of a usage report filtered to show only row that mention "{% data variables.product.prodname_codespaces %}" in the "Product" column.](/assets/images/help/codespaces/CSV-usage-report.png)
9+
![Screenshot of a usage report filtered to show only row that mention "{% data variables.product.prodname_codespaces %}" in the "Product" column.](/assets/images/help/codespaces/csv-usage-report.png)
1010

1111
To see only the costs for creating, updating and storing prebuilds, filter the report to show only rows that mention "Create Codespaces Prebuilds" in the `Actions Workflow` column.
1212

13-
![Screenshot of a usage report filtered to show only details relating to codespace prebuilds.](/assets/images/help/codespaces/CSV-usage-report-prebuilds.png)
13+
![Screenshot of a usage report filtered to show only details relating to codespace prebuilds.](/assets/images/help/codespaces/csv-usage-report-prebuilds.png)

src/assets/middleware/asset-preprocessing.js

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ const regex = /\/cb-\d+\//
1212

1313
export default function assetPreprocessing(req, res, next) {
1414
if (req.path.startsWith('/assets/')) {
15+
// We didn't use to have a rule about all image assets must be
16+
// lower case. So we've exposed things like:
17+
// <img src="/assets/images/Foobar.png"> which means they could
18+
// get a 404 if the file is actually named `foobar.png`.
19+
if (req.url !== req.url.toLowerCase()) {
20+
// The reason for doing a redirect instead rewriting the
21+
// `req.url` attribute is that we don't want encourage this.
22+
// By forcing this to be a redirect, it means we only serve
23+
// 1 single file. All other requests will be redirects.
24+
// Otherwise someone might trigger too much bypassing of the CDN.
25+
return res.redirect(req.url.toLowerCase())
26+
}
27+
1528
// We're only confident enough to set the *manual* surrogate key if the
1629
// asset contains the cache-busting piece.
1730
if (regex.test(req.url)) {

src/assets/tests/static-assets.js

+20
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,24 @@ describe('static assets', () => {
5757
expect(res.headers['content-type']).toContain('text/plain')
5858
checkCachingHeaders(res, true, 60)
5959
})
60+
it("should redirect if the URLisn't all lowercase", async () => {
61+
// Directory
62+
{
63+
const res = await get('/assets/images/SITE/logo.png')
64+
expect(res.statusCode).toBe(302)
65+
expect(res.headers.location).toBe('/assets/images/site/logo.png')
66+
}
67+
// File name
68+
{
69+
const res = await get('/assets/images/site/LoGo.png')
70+
expect(res.statusCode).toBe(302)
71+
expect(res.headers.location).toBe('/assets/images/site/logo.png')
72+
}
73+
// File extension
74+
{
75+
const res = await get('/assets/images/site/logo.PNG')
76+
expect(res.statusCode).toBe(302)
77+
expect(res.headers.location).toBe('/assets/images/site/logo.png')
78+
}
79+
})
6080
})

0 commit comments

Comments
 (0)