|
|
@ -237,17 +237,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState( |
|
|
|
// if path doesn't exist, use `item.url`
|
|
|
|
// if path doesn't exist, use `item.url`
|
|
|
|
if (path) { |
|
|
|
if (path) { |
|
|
|
// try ${appInfo.value.ncSiteUrl}/${item.path} first
|
|
|
|
// try ${appInfo.value.ncSiteUrl}/${item.path} first
|
|
|
|
const url = `${appInfo.value.ncSiteUrl}/${item.path}` |
|
|
|
return Promise.resolve(`${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
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// if it fails, use the original url
|
|
|
|
// if it fails, use the original url
|
|
|
|
return Promise.resolve(item.url) |
|
|
|
return Promise.resolve(item.url) |
|
|
|