Skip to content

Commit

Permalink
fix: gracefully handle empty module identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Delusoire committed Jun 27, 2024
1 parent c40af9d commit d4f9fc1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
14 changes: 0 additions & 14 deletions build/darwin/Contents/Resources/Scripts/main.applescript

This file was deleted.

Binary file modified build/darwin/Contents/Resources/Scripts/main.scpt
Binary file not shown.
Binary file not shown.
10 changes: 6 additions & 4 deletions module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,12 @@ func EnableModuleInVault(identifier StoreIdentifier) error {
module.Enabled = identifier.Version
vault.setModule(identifier.ModuleIdentifier, module)

destroySymlink(identifier.ModuleIdentifier)
if len(module.Enabled) > 0 {
if err := createSymlink(identifier); err != nil {
return err
if len(string(identifier.ModuleIdentifier)) > 0 {
destroySymlink(identifier.ModuleIdentifier)
if len(string(module.Enabled)) > 0 {
if err := createSymlink(identifier); err != nil {
return err
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion module/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type StoreIdentifier struct {
Version
}

var storeIdentifierRe = regexp.MustCompile(`^(?<module_identifier>[^@]+)@(?<version>[^@]*)$`)
var storeIdentifierRe = regexp.MustCompile(`^(?<module_identifier>[^@]*)@(?<version>[^@]*)$`)

func NewStoreIdentifier(identifier string) StoreIdentifier {
parts := storeIdentifierRe.FindStringSubmatch(identifier)
Expand Down

0 comments on commit d4f9fc1

Please sign in to comment.