mirror of
https://github.com/imjasonh/cnotes
synced 2026-07-11 18:31:52 +00:00
Prevent go run install and clean up settings
- Block installation when executable contains 'go-build' in path - Clean up .claude/settings.json to only include properly installed cnotes - Remove changelog line from README as requested
This commit is contained in:
parent
47abf1a0ce
commit
bae042b031
4 changed files with 16 additions and 382 deletions
|
|
@ -70,14 +70,24 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
|||
// Prevent installation from temporary directories (unless uninstalling)
|
||||
if !uninstall {
|
||||
tempDir := os.TempDir()
|
||||
|
||||
// Resolve any symlinks in the executable path for comparison
|
||||
realExecutable, err := filepath.EvalSymlinks(executable)
|
||||
if err != nil {
|
||||
realExecutable = executable // Fall back to original if can't resolve
|
||||
}
|
||||
|
||||
// Also resolve tempDir in case it's a symlink (like /tmp on macOS)
|
||||
realTempDir, err := filepath.EvalSymlinks(tempDir)
|
||||
if err != nil {
|
||||
realTempDir = tempDir
|
||||
}
|
||||
|
||||
// Check if executable is in temp directory
|
||||
if strings.HasPrefix(realExecutable, tempDir) || strings.HasPrefix(executable, "/tmp/") {
|
||||
if strings.HasPrefix(realExecutable, tempDir) ||
|
||||
strings.HasPrefix(executable, tempDir) ||
|
||||
strings.HasPrefix(realExecutable, realTempDir) ||
|
||||
strings.HasPrefix(executable, realTempDir) {
|
||||
return fmt.Errorf("cannot install from temporary directory: %s\nPlease build and install cnotes properly:\n go install && cnotes install", executable)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue