Skip to content

Commit

Permalink
fix(ghub-now): resolve #79 & resolve #82
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <opensource@tunnckocore.com>
  • Loading branch information
tunnckoCore committed Nov 24, 2019
1 parent 7a1c400 commit 0666419
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions web/ghub.now.sh/api/index.js
Expand Up @@ -49,7 +49,9 @@ async function handler(req, res) {
try {
pkg = await packageJson(name);
} catch (err) {
res.send(err.message, 404);
res.setHeader('content-type', 'text/html');
const msg = err.response || err.message;
res.send(`<h1>${msg}</h1>`, 404);
return;
}

Expand All @@ -75,9 +77,8 @@ async function handler(req, res) {
return;
}

const fp = gh.pathname.replace(/\.git$/, '');
// res.send(`B: https://${gh.host}/${fp}`);
res.send(`https://${gh.host}/${fp}`, 301);
res.send(`https://${gh.host}/${gh.repo}`, 301);
return;
}
if (isString(pkg.homepage)) {
Expand Down
2 changes: 1 addition & 1 deletion web/ghub.now.sh/now.json
Expand Up @@ -5,7 +5,7 @@
],
"routes": [
{
"src": "/(?!static)(.+)",
"src": "/(?!static|service-worker*)(.+)",
"dest": "/api/index.js"
},
{
Expand Down

0 comments on commit 0666419

Please sign in to comment.