Closed jbogdani closed 1 year ago
Thanks @jbogdani! Does this create the opposite problem for people including the trailing slash? F.e. example.com/
turning into example.com//assets
and/or example.com/test/
to example.com/test//assets
Hello,
I don't think so, because in l.176 the slash is being removed in the initialisation of basePath
, if present:
const basePath = baseUrl.pathname.endsWith('/') ? baseUrl.pathname.slice(0, -1) : baseUrl.pathname;
That's just for the /graphql endpoint though 🤔 I think we might want to make the changed line (93) a bit smarter by making sure the final URL is correct. It might make more sense to use the URL()
constructor there as well
Yes, you are right. I didn't notice that plugin.url
is using baseUrl
and not basePath
that is already cleaned up.
What if we change l. 93 to something like:
const fileUrl = `${plugin.url}${plugin.url.endsWith('/') ? '' : '/'}assets/${file.id}`;
This is basically how basePath
is defined in l.176.
If it makes sense to you I can update the patch.
Lets do that! Thanks @jbogdani 🙌🏻
This is released under 9.16.2
Fixes the missing slash dividing the base URL from the
asset
. The bug emerges when Directus is installed in a subdirectory.