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

workdirs command assumes that path is b64 encoded #173

Closed
se7entyse7en opened this issue Jul 30, 2019 · 3 comments · Fixed by #183
Closed

workdirs command assumes that path is b64 encoded #173

se7entyse7en opened this issue Jul 30, 2019 · 3 comments · Fixed by #183
Assignees
Labels
bug Something isn't working

Comments

@se7entyse7en
Copy link
Contributor

The workdirs command assumes that the path is base64 encoded, but this is true only for non-local initialization. This is a screenshot of the output of sourced workdirs with one initialized as local and another as org:

Screenshot 2019-07-30 at 21 25 47

@se7entyse7en se7entyse7en added the bug Something isn't working label Jul 30, 2019
@se7entyse7en
Copy link
Contributor Author

The problem is that we assume that here:

	// workdirs for remote orgs encoded into base64
	decoded, err := base64.StdEncoding.DecodeString(p)
	if err == nil {
		return string(decoded), nil
	}

an error is raised when sourced-ce is initialized with local. But actually, some valid paths could be base64 decoded correctly.

@carlosms
Copy link
Contributor

While we are at it, we should change the encoding from base64.StdEncoding to base64.URLEncoding, which is safe to use as file name.

@carlosms
Copy link
Contributor

After discussing it in slack we will go with this structure:

~/.sourced/workdirs/
├─ __active__
├─ local
│  ├── base64(path1)
│  ├── base64(path2)
│  └── ...
└─ orgs
   ├── base64(orgs1)
   ├── base64(orgs2)
   └── ...

This groups deployments initialized with init local or init orgs, and this can be handy in the future. At the same time, having base64 for both local and orgs makes the code easier. And it removes problems when you initialize both with /some/path and /some/path/subdir.

Using URLEncoding.

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.

2 participants