mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-14 17:28:27 +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) {
|
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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user