This repository has been archived by the owner on Aug 23, 2021. It is now read-only.
Duplicate content path added in sys { filename } query on windows #259
Labels
bug
Something isn't working
Description
Describe the issue that you're seeing.
A query like
Will return with an error message like this:
Because the path in the file system it is looking for contains two
/content/posts
instead of one.Steps to reproduce
Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).
Expected result
What should happen?
Content's file info should return from /content/posts/voteForPedro.md
Actual result
What actually happened?
/content/posts/voteForPedro.md
cannot be found because it is looking for/content/posts/content/posts/voteForPedro.md
which adds a duplicate/content/posts/
In triaging I found that this line
tina-graphql-gateway/packages/tina-graphql/src/resolver/index.ts
Line 346 in 454454e
Because the backslashes don't match, the string.replace fails to remove the section data from the relative path. Then the following happens.
tina-graphql-gateway/packages/tina-graphql/src/datasources/data-manager.ts
Line 224 in 454454e
And so when the paths are concatted together here it takes this and duplicates the section data with relative path, because it expects relative path to have already been stripped of sectionData
So the expectation would be to treat all file paths as file paths, not string file paths because I'm assuming the issue here is how windows vs unix treats forward and backslashes in file paths.
Environment
Tinacms Package Versions
Tools
The text was updated successfully, but these errors were encountered: