|
|
|
@ -237,17 +237,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
|
|
|
|
|
// if path doesn't exist, use `item.url`
|
|
|
|
|
if (path) { |
|
|
|
|
// try ${appInfo.value.ncSiteUrl}/${item.path} first
|
|
|
|
|
const url = `${appInfo.value.ncSiteUrl}/${item.path}` |
|
|
|
|
try { |
|
|
|
|
const res = await fetch(url) |
|
|
|
|
if (res.ok) { |
|
|
|
|
// use `url` if it is accessible
|
|
|
|
|
return Promise.resolve(url) |
|
|
|
|
} |
|
|
|
|
} catch { |
|
|
|
|
// for some cases, `url` is not accessible as expected
|
|
|
|
|
// do nothing here
|
|
|
|
|
} |
|
|
|
|
return Promise.resolve(`${appInfo.value.ncSiteUrl}/${item.path}`) |
|
|
|
|
} |
|
|
|
|
// if it fails, use the original url
|
|
|
|
|
return Promise.resolve(item.url) |
|
|
|
|