mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 15:22:26 -05:00 
			
		
		
		
	[bugfix] Don't panic on delivery of Activity with no object (#3730)
		
	This commit is contained in:
		
					parent
					
						
							
								acd3e80ae1
							
						
					
				
			
			
				commit
				
					
						053d820845
					
				
			
		
					 1 changed files with 27 additions and 24 deletions
				
			
		|  | @ -116,33 +116,36 @@ func (f *Federator) PostInboxRequestBodyHook(ctx context.Context, r *http.Reques | ||||||
| 		otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...) | 		otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...) | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Now perform the same checks, but for the Object(s) of the Activity. | 	// Now perform the same checks, but | ||||||
|  | 	// for any Object(s) of the Activity. | ||||||
| 	objectProp := activity.GetActivityStreamsObject() | 	objectProp := activity.GetActivityStreamsObject() | ||||||
| 	for iter := objectProp.Begin(); iter != objectProp.End(); iter = iter.Next() { | 	if objectProp != nil { | ||||||
| 		if iter.IsIRI() { | 		for iter := objectProp.Begin(); iter != objectProp.End(); iter = iter.Next() { | ||||||
| 			otherIRIs = append(otherIRIs, iter.GetIRI()) | 			if iter.IsIRI() { | ||||||
| 			continue | 				otherIRIs = append(otherIRIs, iter.GetIRI()) | ||||||
| 		} | 				continue | ||||||
| 
 |  | ||||||
| 		t := iter.GetType() |  | ||||||
| 		if t == nil { |  | ||||||
| 			continue |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		objectID, err := pub.GetId(t) |  | ||||||
| 		if err == nil { |  | ||||||
| 			otherIRIs = append(otherIRIs, objectID) |  | ||||||
| 		} |  | ||||||
| 
 |  | ||||||
| 		if replyToable, ok := t.(ap.ReplyToable); ok { |  | ||||||
| 			if inReplyToURI := ap.ExtractInReplyToURI(replyToable); inReplyToURI != nil { |  | ||||||
| 				otherIRIs = append(otherIRIs, inReplyToURI) |  | ||||||
| 			} | 			} | ||||||
| 		} |  | ||||||
| 
 | 
 | ||||||
| 		if addressable, ok := t.(ap.Addressable); ok { | 			t := iter.GetType() | ||||||
| 			otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...) | 			if t == nil { | ||||||
| 			otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...) | 				continue | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			objectID, err := pub.GetId(t) | ||||||
|  | 			if err == nil { | ||||||
|  | 				otherIRIs = append(otherIRIs, objectID) | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if replyToable, ok := t.(ap.ReplyToable); ok { | ||||||
|  | 				if inReplyToURI := ap.ExtractInReplyToURI(replyToable); inReplyToURI != nil { | ||||||
|  | 					otherIRIs = append(otherIRIs, inReplyToURI) | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
|  | 			if addressable, ok := t.(ap.Addressable); ok { | ||||||
|  | 				otherIRIs = append(otherIRIs, ap.ExtractToURIs(addressable)...) | ||||||
|  | 				otherIRIs = append(otherIRIs, ap.ExtractCcURIs(addressable)...) | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue