Fix previous fix
This commit is contained in:
		
							parent
							
								
									dc8932cd95
								
							
						
					
					
						commit
						f58c1e4c84
					
				
					 5 changed files with 38 additions and 43 deletions
				
			
		|  | @ -29,7 +29,6 @@ var flagsDefault = []cli.Flag{ | |||
| 
 | ||||
| var ( | ||||
| 	logLevelOverrideRegex = regexp.MustCompile(`(?i)^([^=\s]+)(?:\s*=\s*(\S+))?\s*->\s*(TRACE|DEBUG|INFO|WARN|ERROR)$`) | ||||
| 	topicRegex            = regexp.MustCompile(`^[-_A-Za-z0-9]{1,64}$`) // Same as in server/server.go | ||||
| ) | ||||
| 
 | ||||
| // New creates a new CLI application | ||||
|  |  | |||
|  | @ -249,10 +249,6 @@ func parseTopicMessageCommand(c *cli.Context) (topic string, message string, com | |||
| 	if c.String("message") != "" { | ||||
| 		message = c.String("message") | ||||
| 	} | ||||
| 	if !topicRegex.MatchString(topic) { | ||||
| 		err = fmt.Errorf("topic %s contains invalid characters", topic) | ||||
| 		return | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -108,8 +108,6 @@ func execSubscribe(c *cli.Context) error { | |||
| 	// Checks | ||||
| 	if user != "" && token != "" { | ||||
| 		return errors.New("cannot set both --user and --token") | ||||
| 	} else if !topicRegex.MatchString(topic) { | ||||
| 		return fmt.Errorf("topic %s contains invalid characters", topic) | ||||
| 	} | ||||
| 
 | ||||
| 	if !fromConfig { | ||||
|  | @ -196,7 +194,10 @@ func doSubscribe(c *cli.Context, cl *client.Client, conf *client.Config, topic, | |||
| 			topicOptions = append(topicOptions, auth) | ||||
| 		} | ||||
| 
 | ||||
| 		subscriptionID := cl.Subscribe(s.Topic, topicOptions...) | ||||
| 		subscriptionID, err := cl.Subscribe(s.Topic, topicOptions...) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		if s.Command != "" { | ||||
| 			cmds[subscriptionID] = s.Command | ||||
| 		} else if conf.DefaultCommand != "" { | ||||
|  | @ -206,7 +207,10 @@ func doSubscribe(c *cli.Context, cl *client.Client, conf *client.Config, topic, | |||
| 		} | ||||
| 	} | ||||
| 	if topic != "" { | ||||
| 		subscriptionID := cl.Subscribe(topic, options...) | ||||
| 		subscriptionID, err := cl.Subscribe(topic, options...) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		cmds[subscriptionID] = command | ||||
| 	} | ||||
| 	for m := range cl.Messages { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue