Skip to content

Commit

Permalink
Redirect merge-upstream to staging
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jan 10, 2024
1 parent 28a163e commit 973a1c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ app.use((req, res, next) => {
return;
}

if (branchName === 'merge-upstream') {
const search = url.parse(req.url).search;
res.redirect(`https://staging.turbowarp.org${branchRelativePath}${search || ''}`);
return;
}

req.branchPrefix = prefix;
req.branchRelativePath = branchRelativePath;
} else {
Expand Down
7 changes: 7 additions & 0 deletions test/transitional-redirects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ it('return: redirects', async () => {
.expect(302);
expect(req.headers['location']).toBe('https://turbowarp.org/editor?fps=60');
});

it('merge-upstream: redirects', async () => {
const req = await request.get('/merge-upstream/editor?fps=60')
.set('Host', 'notlocalhost')
.expect(302);
expect(req.headers['location']).toBe('https://staging.turbowarp.org/editor?fps=60');
});

0 comments on commit 973a1c1

Please sign in to comment.