Skip to content

Commit e0a010d

Browse files
committed
try to fix redirects-list.json
1 parent dae5de0 commit e0a010d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/gatsby-theme/src/utils/shared/redirects.test.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,10 @@ describe('getRedirects', () => {
8383

8484
// Detect redirect loops.
8585
const secondUrl = url.parse(addHost(rLocation))
86-
if (secondUrl.hostname === 'downloads.dvc.org') {
86+
if (
87+
secondUrl.hostname === 'downloads.dvc.org' ||
88+
secondUrl.hostname === 'r2.dvc.org'
89+
) {
8790
// downloads.dvc.org redirects are handled externally and does not redirect back to dvc.org.
8891
// Return to prevent endless redirects since some rules redirect to downloads.dvc.org
8992
// and would otherwise match the same redirect rule again.
@@ -134,6 +137,12 @@ describe('getRedirects', () => {
134137
})
135138

136139
describe('toS3', () => {
140+
itRedirects('https://code.dvc.org', 'https://r2.dvc.org/code/', 303)
141+
142+
itRedirects('https://data.dvc.org', 'https://r2.dvc.org/data/', 303)
143+
144+
itRedirects('https://remote.dvc.org', 'https://r2.dvc.org/remote/', 303)
145+
137146
itRedirects(
138147
'https://code.dvc.org/foo/bar',
139148
'https://r2.dvc.org/code/foo/bar',

redirects-list.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"^https://error\\.dvc\\.org/(.*)? https://doc.dvc.org/user-guide/troubleshooting#$1 303",
66
"^https://docs\\.dvc\\.org(.*)? https://doc.dvc.org$1",
7-
"^https://(code|data|remote)\\.dvc\\.org/(.+) https://r2.dvc.org/$1/$2 303",
7+
"^https://(code|data|remote)\\.dvc\\.org(/.*)?$ https://r2.dvc.org/$1$2 303",
88

99
"^https://s\\.dvc\\.org/g/exp/run(.*)?$ https://doc.dvc.org/user-guide/experiment-management/running-experiments$1 302",
1010
"^https://s\\.dvc\\.org/g/exp/(.*)?$ https://doc.dvc.org/user-guide/experiment-management/$1 302",

0 commit comments

Comments
 (0)