Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultipleFileContentsByRef is joining paths when it shouldn't #82

Closed
alfredodeza opened this issue Jul 16, 2020 · 0 comments · Fixed by #83
Closed

MultipleFileContentsByRef is joining paths when it shouldn't #82

alfredodeza opened this issue Jul 16, 2020 · 0 comments · Fixed by #83
Assignees
Labels
bug Something isn't working
Milestone

Comments

@alfredodeza
Copy link
Contributor

This was introduced/modified when writing tests assuming that MultipleFileContentsByRef didn't have a full path already. Specifically this part:

func (s DirectoryResolver) MultipleFileContentsByRef(f ...file.Reference) (map[file.Reference]string, error) {
	refContents := make(map[file.Reference]string)
	for _, fileRef := range f {
		resolvedPath := path.Join(s.Path, string(fileRef.Path))
		_, err := os.Stat(resolvedPath)
		if os.IsNotExist(err) {
			continue
		} else if err != nil {
			log.Errorf("path (%s) is not valid: %v", resolvedPath, err)
		}

There shouldn't be a path.Join at all here. Tests need to be updated as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant