pkg/files: use relative paths in listed files #113
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addressed the bug report hide-org/hide-sdk#22. As noted in the report, the list files endpoint returns absolute paths. Using those paths with other endpoints results in failures because the endpoints expect relative paths. We use relative paths by design aiming to abstract the internal file organisation.
The absolute paths were coming from the file tree walk that we do when listing files. I fixed the issue by using a relative path for
Filecreation. It was not trivial to decide when to extract the relative path. We make multiple calls in the tree walk function, some of them expect absolute path, other – relative. It would be great to review this block and to simplify it.I also simplified test assertions which required reordering of the wanted files.