mirror of https://github.com/minio/minio.git
				
				
				
			
							parent
							
								
									b4ddccc2f7
								
							
						
					
					
						commit
						8bbfb1b714
					
				| 
						 | 
					@ -150,6 +150,12 @@ func (api objectAPIHandlers) PutBucketNotificationHandler(w http.ResponseWriter,
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// Convert the incoming ARNs properly to the GetRegion().
 | 
				
			||||||
 | 
						for i, queueConfig := range notificationCfg.QueueConfigs {
 | 
				
			||||||
 | 
							queueConfig.QueueARN = unmarshalSqsARN(queueConfig.QueueARN).String()
 | 
				
			||||||
 | 
							notificationCfg.QueueConfigs[i] = queueConfig
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Put bucket notification config.
 | 
						// Put bucket notification config.
 | 
				
			||||||
	err = PutBucketNotificationConfig(bucket, ¬ificationCfg, objectAPI)
 | 
						err = PutBucketNotificationConfig(bucket, ¬ificationCfg, objectAPI)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,9 +116,13 @@ func checkARN(arn, arnType string) APIErrorCode {
 | 
				
			||||||
	if len(strs) != 6 {
 | 
						if len(strs) != 6 {
 | 
				
			||||||
		return ErrARNNotification
 | 
							return ErrARNNotification
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if serverConfig.GetRegion() != "" {
 | 
					
 | 
				
			||||||
 | 
						// Server region is allowed to be empty by default,
 | 
				
			||||||
 | 
						// in such a scenario ARN region is not validating
 | 
				
			||||||
 | 
						// allowing all regions.
 | 
				
			||||||
 | 
						if sregion := serverConfig.GetRegion(); sregion != "" {
 | 
				
			||||||
		region := strs[3]
 | 
							region := strs[3]
 | 
				
			||||||
		if region != serverConfig.GetRegion() {
 | 
							if region != sregion {
 | 
				
			||||||
			return ErrRegionNotification
 | 
								return ErrRegionNotification
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -273,9 +277,13 @@ func unmarshalSqsARN(queueARN string) (mSqs arnSQS) {
 | 
				
			||||||
	if len(strs) != 6 {
 | 
						if len(strs) != 6 {
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if serverConfig.GetRegion() != "" {
 | 
					
 | 
				
			||||||
 | 
						// Server region is allowed to be empty by default,
 | 
				
			||||||
 | 
						// in such a scenario ARN region is not validating
 | 
				
			||||||
 | 
						// allowing all regions.
 | 
				
			||||||
 | 
						if sregion := serverConfig.GetRegion(); sregion != "" {
 | 
				
			||||||
		region := strs[3]
 | 
							region := strs[3]
 | 
				
			||||||
		if region != serverConfig.GetRegion() {
 | 
							if region != sregion {
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue