mirror of
https://github.com/imputnet/cobalt.git
synced 2025-02-18 11:20:14 +00:00
fix await error on deepsource
This commit is contained in:
parent
eb5ac709ab
commit
589e96eb4a
|
@ -48,9 +48,12 @@ async function getAccessToken() {
|
|||
}
|
||||
|
||||
async function resolveShortLink(url) {
|
||||
return fetch(url, { method: 'HEAD', redirect: 'manual' })
|
||||
.then(r => r.headers.get('location'))
|
||||
.catch(() => null);
|
||||
try {
|
||||
const response = await fetch(url, { method: 'HEAD', redirect: 'manual' });
|
||||
return response.headers.get('location');
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export default async function(obj) {
|
||||
|
|
Loading…
Reference in a new issue