Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Improve file resolution with the Disk and fallback resolver #231

Merged
merged 2 commits into from Aug 26, 2019
Merged

Improve file resolution with the Disk and fallback resolver #231

merged 2 commits into from Aug 26, 2019

Conversation

hdm
Copy link
Contributor

@hdm hdm commented Aug 26, 2019

This PR improves file resolution in certain corner cases.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found some fixes!

P.S. share your ideas, feedbacks or issues with us at https://github.com/fixmie/feedback (this message will be removed after the beta stage).

@@ -40,6 +45,32 @@ func (d *Disk) Resolve(box string, name string) (file.File, error) {
return nil, os.ErrNotExist
}

// resolvePathInBase returns a path that is guaranteed to be inside of the base directory or an error
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existing comment doesn't match identifier "ResolvePathInBase"

Suggested change
// resolvePathInBase returns a path that is guaranteed to be inside of the base directory or an error
// ResolvePathInBase returns a path that is guaranteed to be inside of the base directory or an error

@@ -40,6 +45,32 @@ func (d *Disk) Resolve(box string, name string) (file.File, error) {
return nil, os.ErrNotExist
}

// resolvePathInBase returns a path that is guaranteed to be inside of the base directory or an error
func ResolvePathInBase(base string, path string) (string, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two or more consecutive named function parameters share a type, you can omit the type from all but the last

Suggested change
func ResolvePathInBase(base string, path string) (string, error) {
func ResolvePathInBase(base, path string) (string, error) {

@markbates markbates merged commit bcc60f5 into gobuffalo:master Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants