Skip to content

Commit 35c4a72

Browse files
committed
fix sonarcloud errors
1 parent 67dc055 commit 35c4a72

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

apps/studio/src/app/api/v1/crawler/route.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function GET(request: NextRequest) {
88
const Base64searchParams = request.nextUrl.searchParams.get('base64');
99
const URLsearchParams = request.nextUrl.searchParams.get('url');
1010

11+
const invalidResponse = new NextResponse('Not a valid URL', { status: 500 });
1112
try {
1213
if (!Base64searchParams && !URLsearchParams) return new NextResponse(null, { status: 200 });
1314
let info: DocumentInfo | null = null;
@@ -23,10 +24,10 @@ export async function GET(request: NextRequest) {
2324
if (response.status === 200) {
2425
info = await parseURL(response.data);
2526
} else {
26-
return new NextResponse('Not a valid URL', { status: 500 });
27+
return invalidResponse;
2728
}
2829
} catch (error) {
29-
return new NextResponse('Not a valid URL', { status: 500 });
30+
return invalidResponse;
3031
}
3132
}
3233

@@ -90,14 +91,15 @@ export async function GET(request: NextRequest) {
9091
</head>
9192
</html>
9293
`;
93-
console.log(crawlerInfo);
94+
9495
return new NextResponse(crawlerInfo, {
9596
status: 200,
9697
headers: {
9798
'Content-Type': 'text/html',
9899
},
99100
});
100101
} catch (err) {
101-
return new NextResponse('Not a valid URL', { status: 500 });
102+
return invalidResponse;
102103
}
103104
}
105+

0 commit comments

Comments
 (0)