Skip to content

Commit

Permalink
Merge pull request #1692 from dandi/embargoed-asset-external-link
Browse files Browse the repository at this point in the history
Use correct asset download URL for external services
  • Loading branch information
waxlamp committed Oct 4, 2023
2 parents 953ccbe + cc0c545 commit 6bee502
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion web/src/views/FileBrowserView/FileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ const updating = ref(false);
// Computed
const owners = computed(() => store.owners?.map((u) => u.username) || null);
const currentDandiset = computed(() => store.dandiset);
const embargoed = computed(() => currentDandiset.value?.dandiset.embargo_status === 'EMBARGOED');
const splitLocation = computed(() => location.value.split('/'));
const isAdmin = computed(() => dandiRest.user?.admin || false);
const isOwner = computed(() => !!(
Expand All @@ -384,11 +385,16 @@ function getExternalServices(path: AssetPath) {
&& _path.aggregate_size <= service.maxsize
);
const baseApiUrl = process.env.VUE_APP_DANDI_API_ROOT;
const assetURL = () => (embargoed.value
? `${baseApiUrl}assets/${path.asset?.asset_id}/download/`
: trimEnd((path.asset as AssetFile).url, '/'));
return EXTERNAL_SERVICES
.filter((service) => servicePredicate(service, path))
.map((service) => ({
name: service.name,
url: `${service.endpoint}${trimEnd((path.asset as AssetFile).url, '/')}`,
url: `${service.endpoint}${assetURL()}`,
}));
}
Expand Down

0 comments on commit 6bee502

Please sign in to comment.