mirror of
https://github.com/directus/directus.git
synced 2026-02-14 22:25:05 -05:00
broken assets paths when serving Directus from a subfolder (#14650)
* removing getrootpath * removed redundant getRootPath from components * We use leading / everywhere else in api usage Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -76,7 +76,6 @@ import api, { addTokenToURL } from '@/api';
|
||||
import { useRelationM2O } from '@/composables/use-relation-m2o';
|
||||
import { RelationQuerySingle, useRelationSingle } from '@/composables/use-relation-single';
|
||||
import { formatFilesize } from '@/utils/format-filesize';
|
||||
import { getRootPath } from '@/utils/get-root-path';
|
||||
import { readableMimeType } from '@/utils/readable-mime-type';
|
||||
import DrawerItem from '@/views/private/components/drawer-item.vue';
|
||||
import FileLightbox from '@/views/private/components/file-lightbox.vue';
|
||||
@@ -129,12 +128,11 @@ const src = computed(() => {
|
||||
if (!image.value) return null;
|
||||
|
||||
if (image.value.type.includes('svg')) {
|
||||
return getRootPath() + `assets/${image.value.id}`;
|
||||
return '/assets/' + image.value.id;
|
||||
}
|
||||
if (image.value.type.includes('image')) {
|
||||
const fit = props.crop ? 'cover' : 'contain';
|
||||
const url =
|
||||
getRootPath() + `assets/${image.value.id}?key=system-large-${fit}&cache-buster=${image.value.modified_on}`;
|
||||
const url = `/assets/${image.value.id}?key=system-large-${fit}&cache-buster=${image.value.modified_on}`;
|
||||
return addTokenToURL(url);
|
||||
}
|
||||
|
||||
@@ -145,7 +143,7 @@ const ext = computed(() => (image.value ? readableMimeType(image.value.type, tru
|
||||
|
||||
const downloadSrc = computed(() => {
|
||||
if (!image.value) return null;
|
||||
return addTokenToURL(getRootPath() + `assets/${image.value.id}`);
|
||||
return addTokenToURL('/assets/' + image.value.id);
|
||||
});
|
||||
|
||||
const meta = computed(() => {
|
||||
|
||||
@@ -142,7 +142,6 @@ import { ref, computed, toRefs } from 'vue';
|
||||
import DrawerCollection from '@/views/private/components/drawer-collection.vue';
|
||||
import api from '@/api';
|
||||
import { readableMimeType } from '@/utils/readable-mime-type';
|
||||
import { getRootPath } from '@/utils/get-root-path';
|
||||
import { unexpectedError } from '@/utils/unexpected-error';
|
||||
import DrawerItem from '@/views/private/components/drawer-item.vue';
|
||||
import { addQueryToPath } from '@/utils/add-query-to-path';
|
||||
@@ -198,7 +197,7 @@ const fileExtension = computed(() => {
|
||||
|
||||
const assetURL = computed(() => {
|
||||
const id = typeof props.value === 'string' ? props.value : props.value?.id;
|
||||
return getRootPath() + `assets/${id}`;
|
||||
return '/assets/' + id;
|
||||
});
|
||||
|
||||
const imageThumbnail = computed(() => {
|
||||
|
||||
Reference in New Issue
Block a user