directus / gatsby-source-directus

Source plugin for pulling data into Gatsby from a Directus API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with directus installed in sub directory

jbogdani opened this issue · comments

When Directus is not installed in the root of the domain but in a sub directory, such as https://example.com/directus the plugin fails to initialise due to a (I believe) typo.

It is looking for files in https://example.com/directusassets/ directory that does not exists and is the result of a missing trailing slash in:
https://github.com/directus/gatsby-source-directus/blob/bfd4f40136dc760a8a9239f19bc691bcf4fb4b40/gatsby-node.js#L93C11-L93C18

In my opinion the line should be (note the slash before assets, that is missing in the main code):

const fileUrl = `${plugin.url}/assets/${file.id}`;

Thank you