fix await error on deepsource

This commit is contained in:
Aholicknight 2024-11-26 09:00:34 -06:00
parent eb5ac709ab
commit 589e96eb4a

View File

@ -48,9 +48,12 @@ async function getAccessToken() {
} }
async function resolveShortLink(url) { async function resolveShortLink(url) {
return fetch(url, { method: 'HEAD', redirect: 'manual' }) try {
.then(r => r.headers.get('location')) const response = await fetch(url, { method: 'HEAD', redirect: 'manual' });
.catch(() => null); return response.headers.get('location');
} catch {
return null;
}
} }
export default async function(obj) { export default async function(obj) {